Commit 1292f41c by weijiguang

init

parents
/.idea/
/target/
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.jair</groupId>
<artifactId>Auto</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>tsndu-service</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<mysql-connector.version>8.0.16</mysql-connector.version>
<mybatis-plus.version>3.0.3</mybatis-plus.version>
<druid.version>1.1.14</druid.version>
<swagger2.version>2.9.2</swagger2.version>
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-gateway</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector.version}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<!-- 模板引擎,需要指定 mpg.setTemplateEngine(new FreemarkerTemplateEngine()); -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>releases</id>
<name>maven-releases</name>
<url>http://repository.sskuaixiu.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>maven-snapshots</name>
<url>http://repository.sskuaixiu.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>maven-central</id>
<name>maven-central</name>
<url>http://repository.sskuaixiu.com/repository/maven-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-central</id>
<name>maven-central</name>
<url>http://repository.sskuaixiu.com/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.jair;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class TsnduApplication {
public static void main(String[] args) {
SpringApplication.run(TsnduApplication.class, args);
}
}
package com.jair.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("com.jair.mapper")
public class MybatisConfig {
/**
* 分页拦截器
* @return
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
package com.jair.config;
import com.alibaba.fastjson.JSONObject;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.service.IAccountService;
import com.jair.util.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Component
@Slf4j
public class RequestFilter implements Filter {
@Autowired
private IAccountService accountService;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String requestUri = ((HttpServletRequest) request).getRequestURI();
if (StringUtils.isEmpty(requestUri)) {
chain.doFilter(request, response);
return;
}
if (requestUri.contains("/account/login")) {
chain.doFilter(request, response);
return;
}
TokenInfo tokenInfo = accountService.getTokenInfo(httpServletRequest);
if (tokenInfo == null) {
//重定向到登录页
tokenError(response);
return;
}
httpServletRequest.getServletContext().setAttribute("TokenInfo", tokenInfo);
chain.doFilter(request, response);
}
private void tokenError(ServletResponse response) throws IOException {
//303状态码表示由于请求对应的资源存在着另一个URI,应使用GET方法定向获取请求的资源
JSONObject resultVo = BeanUtil.transform(ResultVo.loginTimeOutError("token失效"), JSONObject.class);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(resultVo.toJSONString());
}
}
package com.jair.controller;
import com.fasterxml.jackson.databind.ser.Serializers;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CreateAccountPo;
import com.jair.entity.po.LoginPo;
import com.jair.entity.po.UpdateAccountStatusPo;
import com.jair.entity.po.UpdatePasswordPo;
import com.jair.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/account")
public class AccountController extends BaseController {
@Autowired
IAccountService accountService;
@PostMapping("/login")
public ResultVo login(HttpServletRequest request, HttpServletResponse response, @RequestBody LoginPo loginPo) {
return accountService.login(request, response, loginPo);
}
@PostMapping("/list/{companyId}")
public ResultVo list(HttpServletRequest request, @PathVariable Integer companyId) {
TokenInfo tokenInfo = getTokenInfo(request);
return ResultVo.success(accountService.listAccounts(tokenInfo, companyId, null));
}
@PostMapping("/list/mine")
public ResultVo listMine(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return ResultVo.success(accountService.listAccounts(tokenInfo, tokenInfo.getCompanyId(), null));
}
@PostMapping("/create")
public ResultVo create(HttpServletRequest request, @RequestBody CreateAccountPo createAccountPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return accountService.createAccount(tokenInfo, createAccountPo);
}
@PostMapping("/update/password")
public ResultVo create(HttpServletRequest request, @RequestBody UpdatePasswordPo updatePasswordPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return accountService.updatePassword(tokenInfo, updatePasswordPo);
}
@PostMapping("/update/status")
public ResultVo create(HttpServletRequest request, @RequestBody UpdateAccountStatusPo updateStatusPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return accountService.updateStatus(tokenInfo, updateStatusPo);
}
}
package com.jair.controller;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.service.IAnalyticsService;
import com.jair.service.IFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
@RestController
@RequestMapping("/analytics")
public class AnalyticsController extends BaseController {
@Autowired
private IAnalyticsService analyticsService;
@PostMapping("/dashboard")
public ResultVo list(HttpServletRequest request) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return analyticsService.dashboard(tokenInfo);
}
}
package com.jair.controller;
import com.jair.entity.common.TokenInfo;
import javax.servlet.http.HttpServletRequest;
public class BaseController {
public static String TOKEN_INFO = "TokenInfo";
public TokenInfo getTokenInfo(HttpServletRequest request) {
return (TokenInfo)request.getServletContext().getAttribute(TOKEN_INFO);
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CompanyPo;
import com.jair.entity.po.SearchCompanyPo;
import com.jair.service.ICompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/company")
public class CompanyController extends BaseController {
@Autowired
ICompanyService companyService;
@PostMapping("/create")
public ResultVo createCompnay(HttpServletRequest request, @RequestBody CompanyPo companyPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.createCompany(tokenInfo, companyPo);
}
@PostMapping("/list")
public ResultVo listCompnay(HttpServletRequest request, @RequestBody PageInfo<SearchCompanyPo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.listCompanys(tokenInfo, pageInfo);
}
@PostMapping("/mine")
public ResultVo mine(HttpServletRequest request) throws InterruptedException {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.myCompany(tokenInfo);
}
@PostMapping("/update/status")
public ResultVo updateStatus(HttpServletRequest request, @RequestBody CompanyPo companyPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.updateStatus(tokenInfo, companyPo);
}
@PostMapping("/update/expired")
public ResultVo updateExpired(HttpServletRequest request, @RequestBody CompanyPo companyPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.updateExpiredDate(tokenInfo, companyPo);
}
@PostMapping("/update")
public ResultVo updateCompany(HttpServletRequest request, @RequestBody CompanyPo companyPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return companyService.updateCompany(tokenInfo, companyPo);
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.service.IContractService;
import com.jair.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/contract")
public class ContractController extends BaseController {
@Autowired
private IContractService contractService;
@PostMapping("/list")
public ResultVo listVehicle(HttpServletRequest request, @RequestBody PageInfo<SearchContractPo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.listContracts(tokenInfo, pageInfo);
}
@PostMapping("/get/{contractId}")
public ResultVo get(HttpServletRequest request, @PathVariable Integer contractId) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.getContractById(tokenInfo, contractId);
}
@PostMapping("/sign")
public ResultVo signContract(HttpServletRequest request, @RequestBody SignContractPo contractPo) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.signContract(tokenInfo, contractPo);
}
@PostMapping("/update")
public ResultVo updateContract(HttpServletRequest request, @RequestBody UpdateContractPo contractPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.updateContract(tokenInfo, contractPo);
}
@PostMapping("/terminate")
public ResultVo terminateContract(HttpServletRequest request, @RequestBody TerminateContractPo contractPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.terminateContract(tokenInfo, contractPo);
}
@PostMapping("/return/deposit")
public ResultVo returnDeposit(HttpServletRequest request, @RequestBody ReturnDepositPo contractPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.returnDeposit(tokenInfo, contractPo);
}
@PostMapping("/logs/{contractId}")
public ResultVo contractLogs(HttpServletRequest request, @PathVariable Integer contractId) {
TokenInfo tokenInfo = getTokenInfo(request);
return contractService.getContractLogs(tokenInfo, contractId);
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.service.ICompanyService;
import com.jair.service.IDataService;
import com.jair.service.IDriverService;
import com.jair.service.ISourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
@RestController
@RequestMapping("/data")
public class DataController extends BaseController {
@Autowired
IDataService dataService;
@Autowired
ISourceService sourceService;
@PostMapping("/sources")
public ResultVo listSource(HttpServletRequest request, @RequestBody SourcePo sourcePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return sourceService.listSources(tokenInfo, sourcePo);
}
@PostMapping("/source/update/status")
public ResultVo updateSourceStatus(HttpServletRequest request, @RequestBody SourcePo sourcePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return sourceService.updateSourceStatus(tokenInfo, sourcePo);
}
@PostMapping("/source/create")
public ResultVo createSource(HttpServletRequest request, @RequestBody SourcePo sourcePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return sourceService.createSource(tokenInfo, sourcePo);
}
@PostMapping("/source/update")
public ResultVo updateSource(HttpServletRequest request, @RequestBody SourcePo sourcePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return sourceService.updateSource(tokenInfo, sourcePo);
}
@PostMapping("/colors")
public ResultVo listColor(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listColors(tokenInfo);
}
@PostMapping("/environmentalStandards")
public ResultVo listEnvironmentalStandards(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listEnvironmentalStandards(tokenInfo);
}
@PostMapping("/engineTypes")
public ResultVo listEngineTypes(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listEngineTypes(tokenInfo);
}
@PostMapping("/vehicleTypes")
public ResultVo listVehicleTypes(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listVehicleTypes(tokenInfo);
}
@PostMapping("/useCharacters")
public ResultVo listUseCharacters(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listUseCharacters(tokenInfo);
}
@PostMapping("/brands")
public ResultVo listBrand(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listBrands(tokenInfo);
}
@PostMapping("/models")
public ResultVo listModel(HttpServletRequest request, @RequestBody SearchDataPo searchPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.listModels(tokenInfo, searchPo);
}
@PostMapping("/create")
public ResultVo createData(HttpServletRequest request, @RequestBody SysDataPo dataPo) {
TokenInfo tokenInfo = getTokenInfo(request);
return dataService.createData(tokenInfo, dataPo);
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.service.IDataService;
import com.jair.service.IDriverService;
import com.jair.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/driver")
public class DriverController extends BaseController {
@Autowired
IDriverService driverService;
@PostMapping("/list")
public ResultVo listVehicle(HttpServletRequest request, @RequestBody PageInfo<SearchDriverPo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return driverService.listDrivers(tokenInfo, pageInfo);
}
@PostMapping("/get/{driverId}")
public ResultVo get(HttpServletRequest request, @PathVariable Integer driverId) {
TokenInfo tokenInfo = getTokenInfo(request);
return driverService.getDriverById(tokenInfo, driverId);
}
@PostMapping("/list/all")
public ResultVo listVehicle(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return driverService.listAllDrivers(tokenInfo);
}
@PostMapping("/create")
public ResultVo createDriver(HttpServletRequest request, @RequestBody DriverPo driverPo) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return driverService.createDriver(tokenInfo, driverPo);
}
@PostMapping("/update")
public ResultVo updateDriver(HttpServletRequest request, @RequestBody DriverPo driverPo) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return driverService.updateDriver(tokenInfo, driverPo);
}
}
package com.jair.controller;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SearchDataPo;
import com.jair.entity.po.SourcePo;
import com.jair.entity.po.SysDataPo;
import com.jair.service.IDataService;
import com.jair.service.IFeeService;
import com.jair.service.ISourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/fee")
public class FeeController extends BaseController {
@Autowired
IFeeService feeService;
@PostMapping("/list/{status}")
public ResultVo list(HttpServletRequest request, @PathVariable Integer status) {
TokenInfo tokenInfo = getTokenInfo(request);
return feeService.list(tokenInfo, status);
}
@PostMapping("/create")
public ResultVo createData(HttpServletRequest request, @RequestBody CfgFee fee) {
TokenInfo tokenInfo = getTokenInfo(request);
return feeService.create(tokenInfo, fee);
}
@PostMapping("/disable/{feeId}")
public ResultVo disable(HttpServletRequest request, @PathVariable Integer feeId) {
TokenInfo tokenInfo = getTokenInfo(request);
return feeService.disable(tokenInfo, feeId);
}
@PostMapping("/enable/{feeId}")
public ResultVo enable(HttpServletRequest request, @PathVariable Integer feeId) {
TokenInfo tokenInfo = getTokenInfo(request);
return feeService.enable(tokenInfo, feeId);
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.service.IContractService;
import com.jair.service.IPlanningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/planning")
public class PlanningController extends BaseController {
@Autowired
private IPlanningService planningService;
@PostMapping("/list")
public ResultVo listPlanning(HttpServletRequest request, @RequestBody PageInfo<SearchPlanningPo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return planningService.listPlanning(tokenInfo, pageInfo);
}
@PostMapping("/list/logs")
public ResultVo listPlanningOperationLogs(HttpServletRequest request, @RequestBody PageInfo<SearchPlanningLogPo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return planningService.listLogs(tokenInfo, pageInfo);
}
@PostMapping("/list/{contractId}/{type}")
public ResultVo listPlanning(HttpServletRequest request, @PathVariable Integer contractId, @PathVariable Integer type) {
TokenInfo tokenInfo = getTokenInfo(request);
return planningService.listPlanningByContractId(tokenInfo, contractId, type);
}
@PostMapping("/paying")
public ResultVo paying(HttpServletRequest request, @RequestBody PayingPo payingPo) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return planningService.paying(tokenInfo, payingPo);
}
@PostMapping("/delay")
public ResultVo delay(HttpServletRequest request, @RequestBody DelayPo delayPo) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return planningService.delay(tokenInfo, delayPo);
}
}
package com.jair.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jair.entity.bo.Account;
import com.jair.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class TestController {
@PostMapping("hello")
public String hello(@RequestBody String body) {
System.out.println("body:" + body);
return "hello";
}
}
package com.jair.controller;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.DetectImagePo;
import com.jair.service.IAttFileService;
import com.jair.util.BaiduAI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/file")
public class UploadController extends BaseController {
@Autowired
private IAttFileService attFileService;
@Autowired
private BaiduAI baiduAI;
@PostMapping("/upload")
public ResultVo uploadFile(HttpServletRequest request, @RequestParam("file") MultipartFile multipartFile) throws Exception {
TokenInfo tokenInfo = getTokenInfo(request);
return attFileService.upload(tokenInfo, multipartFile);
}
@PostMapping("/vehicle/license/detect")
public ResultVo detectVehicleLicense(@RequestBody DetectImagePo detectPo) throws Exception {
System.out.println(detectPo);
return ResultVo.success(baiduAI.vehicleLicenseDetect(detectPo.getUrl(), detectPo.getIsMain() == 1 ? true : false));
}
@PostMapping("/driver/license/detect")
public ResultVo detectDriverLicense(@RequestBody DetectImagePo detectPo) throws Exception {
System.out.println(detectPo);
return ResultVo.success(baiduAI.drivingLicenseDetect(detectPo.getUrl()));
}
@PostMapping("/identity/card/detect")
public ResultVo detectIdentityCard(@RequestBody DetectImagePo detectPo) throws Exception {
System.out.println(detectPo);
return ResultVo.success(baiduAI.identityCardDetect(detectPo.getUrl(), detectPo.getIsMain() == 3 ? true : false));
}
}
package com.jair.controller;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.service.ICompanyService;
import com.jair.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/vehicle")
public class VehicleController extends BaseController {
@Autowired
IVehicleService vehicleService;
@PostMapping("/list")
public ResultVo listVehicle(HttpServletRequest request, @RequestBody PageInfo<SearchVechiclePo> pageInfo) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.listVehicles(tokenInfo, pageInfo);
}
@PostMapping("/get/{vehicleId}")
public ResultVo get(HttpServletRequest request, @PathVariable Integer vehicleId) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.getVehicleById(tokenInfo, vehicleId);
}
@PostMapping("/create")
public ResultVo createVehicle(HttpServletRequest request, @RequestBody CreateVehiclePo vehiclePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.createVehicle(tokenInfo, vehiclePo);
}
@PostMapping("/update")
public ResultVo updateVehicle(HttpServletRequest request, @RequestBody UpdateVehiclePo vehiclePo) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.updateVehicle(tokenInfo, vehiclePo);
}
@PostMapping("/no/source/contract/vehicles")
public ResultVo listNoSourceContractVehicles(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.listNoSourceContractVehicles(tokenInfo);
}
@PostMapping("/allow/rent/vehicles")
public ResultVo listAllowRentVehicles(HttpServletRequest request) {
TokenInfo tokenInfo = getTokenInfo(request);
return vehicleService.listAllowRentVehicles(tokenInfo);
}
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 帐号
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Account implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 帐号 */
private String username;
/** 密码 */
private String password;
/** 姓名 */
private String realName;
/** 电话 */
private String phone;
/** 地址 */
private String address;
/** 状态:0停用,1有效 */
private Integer status;
private Date createTime;
private Integer createById;
private String createByName;
/** 帐号类型:0超管,1主帐号,2子帐号 */
private Integer type;
private Integer companyId;
private String companyName;
private String token;
private Date tokenExpiredTime;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class AttFile implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 原始文件名
*/
private String originName;
/**
* 文件url
*/
private String filePath;
/**
* 文件类型
*/
private Integer fileType;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CfgData implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer parentId;
private String code;
private String name;
@TableField("extends")
private String extend;
/** @DataTypeEnum */
private Integer type;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CfgFee implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
/** @FeeTimingEnum */
private Integer timing;
private Integer amount;
private Integer companyId;
private Integer status;
@TableField(exist = false)
private Integer firstPaidAmount;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 企业主体
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Company implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 公司名称
*/
private String name;
/**
* 简称
*/
private String abbr;
/**
* 地址
*/
private String address;
/**
* 联系人
*/
private String contactName;
/**
* 联系电话
*/
private String contactPhone;
/**
* 省
*/
private String province;
/**
* 市
*/
private String city;
/**
* 区
*/
private String district;
private Date createTime;
private Integer createById;
private String createByName;
/**
* 有效日期
*/
private Date expiredDate;
private Integer status;
private Integer level; // 1:5个子帐号,2:10个子帐号,3:50个子帐号
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Contract implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 合同类型,1车源合同,2司机合同 */
private Integer type;
/** 合同编号 */
private String code;
/** 车辆信息 */
private Integer vehicleId;
/** 车源信息 */
private Integer sourceId;
/** 司机信息 */
private Integer driverId;
/** 里程数 */
private Integer odograph;
/** ev里程数 */
private Integer odographEv;
/** 租赁开始日期 */
private Date startDate;
/** 租赁结束日期 */
private Date endDate;
/** 押金状态:@DepositStatusEnum */
private Integer depositStatus;
/** 应付押金 */
private Integer payableDepositAmount;
/** 已付押金 */
private Integer paidDepositAmount;
/** 返还押金金额 */
private Integer returnDepositAmount;
/** 租赁方式 */
private Integer leaseType;
/** 租金 */
private Integer rentAmount;
/** 状态:1正常有效,0已结束 */
private Integer status;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
private String remark;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ContractOperationLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 1车源合同,2司机合同
*/
private Integer type;
/**
* 合同id
*/
private Integer contractId;
/**
* 日志动作
*/
private String action;
/**
* 日志内容
*/
private String content;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date operationTime;
private Integer operatorId;
private String operatorName;
/**
* 1有效,0失效
*/
private Integer status;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ContractReturnVehicle implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer contractId;
private Integer license;
private Integer accident;
private Integer breakRulesAmount;
private Integer breakRulesDeduction;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ContractReturnVehicleAttachment implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 合同id
*/
private Integer returnId;
private Integer fileId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ContractSignAttachment implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 合同id
*/
private Integer contractId;
private Integer fileId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Driver implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 身份证号码 */
private String identityNumber;
/** 姓名 */
private String name;
/** 性别 */
private String gender;
/** 电话 */
private String phone;
/** 现住址 */
private String address;
/** 紧急联系人 */
private String contactName;
/** 紧急联系人电话 */
private String contactPhone;
/** 是否有网约车执照:0无,1有 */
private Integer serviceLicense;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
/** 身份证id */
private Integer identityId;
/** 驾驶证id */
private Integer licenseId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 驾驶证
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DrivingLicense implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 驾驶证号 */
private String credentialNo;
/** 档案编号 */
private String fileNo;
/** 国籍 */
private String country;
/** 首次发证日期 */
private Date firstIssue;
/** 准驾车型 */
@TableField("class")
private String drivingClass;
/** 有效期-起 */
private Date validPeriodStart;
/** 有效期-止 */
private Date validPeriodEnd;
/** 主页照片 */
private Integer mainFileId;
/** 副页照片 */
private Integer secondFileId;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class FeePlanning implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 费用类型 */
private Integer type;
/** 费用名称 */
private String name;
/** 合同ID */
private Integer contractId;
/** 合同类型 */
private Integer contractType;
/*** 计划执行日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDate;
/*** 延期至的 日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date delayDate;
/** 应付金额 */
private Integer payableAmount;
/** 已付金额 */
private Integer paidAmount;
/** 状态:0未付,1已付部分,2已付全部 */
private Integer paymentStatus;
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
private Integer status;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class IdentityCard implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 民族 */
private String nation;
/** 出生日期 */
private Date birthday;
/** 身份证地址 */
private String originAddress;
/** 发证机关 */
private String issueOrganization;
/** 有效期-起 */
private Date validPeriodStart;
/** 有效期-止 */
private Date validPeriodEnd;
/** 正面照片 */
private Integer frontFileId;
/** 反面照片 */
private Integer backFileId;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Menu implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer accountType;
private String menus;
private Integer status;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 车队表
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Motorcade implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
private String contactName;
private String contactPhone;
private String address;
private String remark;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class PlanningOperationLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 合同ID */
private Integer contractId;
/** 合同类型 */
private Integer planningId;
/** @PlanningLogActionEnum */
private Integer type;
/** @PlanningLogActionEnum */
private String action;
/** 金额 */
private Integer amount;
private String remark;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("`sequence`")
public class Sequence implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 车源信息
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Source implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 车源名称
*/
private String name;
/**
* 地址
*/
private String address;
/**
* 联系人
*/
private String contactName;
/**
* 电话
*/
private String contactPhone;
private Date createTime;
private Integer createById;
private String createByName;
private Integer status;
/**
* 关联主体
*/
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 车辆信息
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Vehicle implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/** 车牌号码 */
private String plateNo;
/** 品牌 */
private String brandName;
/** 型号 */
private String model;
/** 排量 */
private String displacement;
/** 颜色 */
private String color;
/** 环保标准 */
private String environmentalStandards;
/** 动力类型 */
private String engineType;
private String remark;
private Integer licenseId;
/** 状态,1正常,0失效(已退) */
private Integer status;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 行驶证
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class VehicleLicense implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer licenseId;
/** 车辆类型:小型轿车 */
private String type;
/** 所有人 */
private String owner;
/** 住址 */
private String address;
/** 使用性质:非营运 */
private String useCharacter;
/** 型号 */
@TableField("model")
private String licenseModel;
/** 识别代号 */
private String vin;
/** 发动机号码 */
private String engineNo;
/** 注册日期 */
private Date registerDate;
/** 发证日期 */
private Date issueDate;
/** 核载人数 */
private String approvedPerson;
/** 总质量 */
private String weight;
/** 尺寸 */
private String outlineSize;
/** 行驶证主页照片 */
private Integer mainFileId;
/** 行驶证副页照片 */
private Integer secondFileId;
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
}
package com.jair.entity.common;
import lombok.Data;
import java.util.Date;
@Data
public class AppInfo {
private String token;
private Integer activeDuration;
private Date generateTime;
}
package com.jair.entity.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 分页页面信息
*
* @author caiyt
*/
@Data
@ApiModel(value = "分页页面信息", description = "分页页面的数据封装类")
public class PageInfo<T> {
@ApiModelProperty(value = "当前页数")
private Long current;
@ApiModelProperty(value = "页面数据量")
private Long size;
@ApiModelProperty(value = "数据总量")
private Long total;
@ApiModelProperty(value = "数据内容")
private T records;
@Override
public String toString() {
return "PageInfo{current=" + current + ", size=" + size + ", total=" + total + ", records=" + records + '}';
}
public PageInfo() {
}
public PageInfo(Long total, T records) {
this.total = total;
this.records = records;
}
public PageInfo(Long current, Long size) {
this.current = current;
this.size = size;
}
/**
* 对分页请求参数进行校验更正
*
* @param pageInfo
*/
public static PageInfo checkParam(PageInfo pageInfo) {
if (pageInfo == null) {
pageInfo = new PageInfo<>(1L, 10L);
} else {
if (pageInfo.getCurrent() == null || pageInfo.getCurrent() <= 0) {
pageInfo.setCurrent(1L);
}
if (pageInfo.getSize() == null || pageInfo.getSize() == 0) {
pageInfo.setSize(10L);
}
}
return pageInfo;
}
}
\ No newline at end of file
package com.jair.entity.common;
import lombok.Getter;
/**
* @author: mazhang
* @date: 2019/08/08 15:16 update by caiyt @2019/08/24
* @description: 返回的错误码常量类
*/
@Getter
public class ResultConstants {
/**
* 成功
*/
public static final int SUCCESS = 1;
/**
* 登陆超时
*/
public static final int LOGIN_TIMEOUT = 2;
/**
* 业务异常
*/
public static final int ILLEGAL_BUSINESS = 3;
/**
* 账户冻结
*/
public static final int FROZEN_ACCOUNT = 201;
/**
* 系统异常
*/
public static final int SYSTEM_ERROR = 999;
}
\ No newline at end of file
package com.jair.entity.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 响应封装类
*
* @param <T>
*/
@Data
@ApiModel("响应类")
public class ResultVo<T> {
@ApiModelProperty("响应码:1-成功 2-登陆超时 3-业务异常 4-系统异常")
private int code;
@ApiModelProperty("响应消息")
private String msg;
@ApiModelProperty("响应体")
private T data;
public static <T> ResultVo success() {
return success(null);
}
public static <T> ResultVo success(T data) {
return resultVo(ResultConstants.SUCCESS,"成功",data);
}
public static <T> ResultVo businessError(String message){
return resultVo(ResultConstants.ILLEGAL_BUSINESS,message,null);
}
public static <T> ResultVo accountFrozenError(String message){
return resultVo(ResultConstants.FROZEN_ACCOUNT,message,null);
}
public static <T> ResultVo systemError(String message){
return resultVo(ResultConstants.SYSTEM_ERROR,message,null);
}
public static <T> ResultVo loginTimeOutError(String message){
return resultVo(ResultConstants.LOGIN_TIMEOUT,message,null);
}
private static <T> ResultVo<T> resultVo(int code, String msg, T data){
ResultVo resultVo = new ResultVo();
resultVo.setCode(code);
resultVo.setMsg(msg);
if (data != null) {
resultVo.setData(data);
}
return resultVo;
}
public ResultVo() {
this(ResultConstants.SUCCESS, "成功");
}
public ResultVo(int code, String msg) {
this(code, msg, null);
}
public ResultVo(int code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public boolean isSuccess(){
return ResultConstants.SUCCESS==this.code;
}
}
\ No newline at end of file
package com.jair.entity.common;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel("token信息相应类")
public class TokenInfo {
@ApiModelProperty("帐号id")
private Integer id;
@ApiModelProperty("用户账号")
private String username;
@ApiModelProperty("用户姓名")
private String realName;
@ApiModelProperty("电话")
private String phone;
@ApiModelProperty("帐号类型:0超管,1主帐号,2子帐号")
private Integer type;
@ApiModelProperty("用户所属组织id")
private Integer companyId;
@ApiModelProperty("用户所属组织名称")
private String companyName;
private String abbr;
private String token;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date tokenExpiredTime;
private String menus;
//
// /**
// * 获取系统用户
// *
// * @return
// */
// public static TokenInfoVo genSystemTokenInfo() {
// return new TokenInfoVo(SystemConstants.SYSTEM_ID, SystemConstants.SYSTEM_NAME);
// }
}
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum AccountTypeEnum {
ADMIN(0, "管理员"),
MAIN(1, "主帐号"),
SUB(2, "子帐号");
private Integer key;
private String value;
AccountTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum ContractLogActionEnum {
CREATE("创建"),
UPDATE("修改"),
RENEW("续约"),
TERMINATE("中止"),
CHECK("验车"),
RETURN_VEHICLE("交车信息"),
RETURN_DEPOSIT("返还押金"),
;
private String name;
ContractLogActionEnum(String name) {
this.name = name;
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum ContractTypeEnum {
SOURCE_CONTRACT(1, "车源合同"),
DRIVER_CONTRACT(2, "司机合同");
private Integer key;
private String value;
ContractTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum DataTypeEnum {
ENVIRONMENTAL_STANDARDS(1, "环保标准"),
CHARACTER(2, "车辆使用性质"),
COLOR(3, "颜色"),
ENGINE_TYPE(4, "动力类型"),
VEHICLE_TYPE(5, "车型类型"),
BRAND(6, "品牌"),
MODEL(7, "型号");
private Integer key;
private String value;
DataTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum DepositStatusEnum {
ARREARAGE(-1, "押金不全"),
NORMAL(0, "正常"),
PORTION_RETURN(1, "部分已退"),
ALL_RETURN(2, "全部已退");
private Integer key;
private String value;
DepositStatusEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public static String codeToName(Integer code) {
if (code == ARREARAGE.getKey()) {
return ARREARAGE.getValue();
} else if (code == NORMAL.getKey()) {
return NORMAL.getValue();
} else if (code == PORTION_RETURN.getKey()) {
return PORTION_RETURN.getValue();
} else if (code == ALL_RETURN.getKey()) {
return ALL_RETURN.getValue();
}
return "";
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
/** 费用周期 */
@Getter
public enum FeeTimingEnum {
ONCE(1, "一次性"),
WEEK(2, "周度"),
MONTH(3, "月度"),
QUARTER(4, "季度"),
YEAR(5, "年度");
private Integer key;
private String value;
FeeTimingEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum LeaseTypeEnum {
DAY_OF_MONTH(1, "月租(30天)"),
MONTH(2, "月租(自然月)"),
WEEK(3, "周租");
private Integer key;
private String value;
LeaseTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public static String codeToName(Integer code) {
if (code == DAY_OF_MONTH.getKey()) {
return DAY_OF_MONTH.getValue();
} else if (code == MONTH.getKey()) {
return MONTH.getValue();
} else if (code == WEEK.getKey()) {
return WEEK.getValue();
}
return "";
}
}
\ No newline at end of file
package com.jair.entity.constant;
import lombok.Getter;
@Getter
public enum PlanningLogActionEnum {
PAYING(1, "付款"),
DELAY(2, "延期"),
;
private Integer type;
private String name;
PlanningLogActionEnum(Integer type, String name) {
this.type = type;
this.name = name;
}
}
\ No newline at end of file
package com.jair.entity.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CfgFeePo implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
/** @FeeTimingEnum */
private Integer timing;
private Integer amount;
private Integer firstPaidAmount;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.Date;
@Data
public class CompanyPo extends Validation {
private Integer id;
/** 公司名称 */
private String name;
/** 简称 */
private String abbr;
/** 地址 */
private String address;
/** 联系人 */
private String contactName;
/** 联系电话 */
private String contactPhone;
/** 省 */
private String province;
/** 市 */
private String city;
/** 区 */
private String district;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expiredDate;
private Integer status;
private Integer level;
@Override
public ValidateResult validate() {
if (StringUtils.isEmpty(this.getName())) {
return ValidateResult.fail("企业名称不能为空");
}
if (this.getName().length() < 4) {
return ValidateResult.fail("企业名称不能少于4位");
}
if (StringUtils.isEmpty(this.getAbbr())) {
return ValidateResult.fail("企业简称不能为空");
}
if (this.getAbbr().length() < 2) {
return ValidateResult.fail("企业简称不能少于2位");
}
if (StringUtils.isEmpty(this.getContactName()) || StringUtils.isEmpty(this.getContactPhone())) {
return ValidateResult.fail("企业联系人和联系电话不能为空");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import com.jair.entity.constant.AccountTypeEnum;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class CreateAccountPo extends Validation {
/** 帐号 */
private String username;
/** 密码 */
private String password;
/** 姓名 */
private String realName;
/** 电话 */
private String phone;
/** 地址 */
private String address;
/** 帐号类型:0超管,1主帐号,2子帐号 */
private Integer type;
private Integer companyId;
@Override
public ValidateResult validate() {
if (this.getCompanyId() == null || this.getCompanyId() <= 0) {
return ValidateResult.fail("未知的企业");
}
if (StringUtils.isEmpty(this.getUsername()) || this.getUsername().trim().length() < 4) {
return ValidateResult.fail("帐号长度不能小于4位");
}
if (StringUtils.isEmpty(this.getPassword()) || this.getPassword().length() < 6) {
return ValidateResult.fail("密码长度不能小于6位");
}
if (StringUtils.isEmpty(this.getRealName()) || this.getRealName().trim().length() < 2) {
return ValidateResult.fail("姓名长度不能小于2位");
}
if (StringUtils.isEmpty(this.getPhone()) || this.getPhone().trim().length() != 11) {
return ValidateResult.fail("电话输入不正确");
}
if (this.getType() != AccountTypeEnum.MAIN.getKey() && this.getType() != AccountTypeEnum.SUB.getKey()) {
return ValidateResult.fail("帐号类型不正确");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.Date;
@Data
public class CreateVehiclePo extends Validation {
/** 品牌 */
private String brandName;
/** 型号 */
private String model;
/** 排量 */
private String displacement;
/** 颜色 */
private String color;
/** 环保标准 */
private String environmentalStandards;
/** 动力类型 */
private String engineType;
/** 车牌号码 */
private String plateNo;
/** 车辆类型:小型轿车 */
private String type;
/** 所有人 */
private String owner;
/** 住址 */
private String address;
/** 使用性质:非营运 */
private String useCharacter;
/** 型号 */
private String licenseModel;
/** 识别代号 */
private String vin;
/** 发动机号码 */
private String engineNo;
/** 注册日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date registerDate;
/** 发证日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date issueDate;
/** 核载人数 */
private String approvedPerson;
/** 总质量 */
private String weight;
/** 尺寸 */
private String outlineSize;
/** 行驶证主页照片 */
private Integer mainFileId;
/** 行驶证副页照片 */
private Integer secondFileId;
private String remark;
@Override
public ValidateResult validate() {
if (StringUtils.isEmpty(this.getPlateNo())) {
return ValidateResult.fail("请输入完整车牌号");
}
this.setPlateNo(this.getPlateNo().toUpperCase());
if (!this.getPlateNo().matches("^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$")) {
return ValidateResult.fail("车牌号格式不正确");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class DelayPo extends Validation {
private Integer planningId;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date delayDate;
private String remark;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class DetectImagePo {
private String url;
private Integer isMain;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@Data
public class DriverPo extends Validation {
private Integer id;
/** 姓名 */
private String name;
/** 身份证号码 */
private String identityNumber;
/** 性别 */
private String gender;
/** 电话 */
private String phone;
/** 现住址 */
private String address;
/** 紧急联系人 */
private String contactName;
/** 紧急联系人电话 */
private String contactPhone;
/** 是否有网约车执照:0无,1有 */
private Integer serviceLicense;
// 身份证信息
/** 民族 */
private String nation;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
/** 身份证地址 */
private String originAddress;
/** 发证机关 */
private String issueOrganization;
/** 身份证 有效期-起 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date identityValidPeriodStart;
/** 身份证 有效期-止 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date identityValidPeriodEnd;
/** 身份证 正面照片 */
private Integer frontFileId;
/** 身份证 反面照片 */
private Integer backFileId;
// 驾照信息
/** 驾驶证号 */
private String credentialNo;
/** 档案编号 */
private String fileNo;
/** 首次发证日期 */
private Date firstIssue;
/** 驾照 准驾车型 */
private String drivingClass;
/** 驾照 有效期-起 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date licenseValidPeriodStart;
/** 驾照 有效期-止 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date licenseValidPeriodEnd;
/** 驾照 主页照片 */
private Integer mainFileId;
/** 驾照 副页照片 */
private Integer secondFileId;
@Override
public ValidateResult validate() {
if (StringUtils.isEmpty(this.getName()) || this.getName().trim().length() < 2) {
return ValidateResult.fail("姓名不正确");
}
if (StringUtils.isEmpty(this.getGender())) {
return ValidateResult.fail("性别不正确");
}
List<String> genders = Arrays.asList("男", "女");
if (!genders.contains(this.getGender().trim())) {
return ValidateResult.fail("性别不正确");
}
if (StringUtils.isEmpty(this.getIdentityNumber())) {
return ValidateResult.fail("身份证号码不正确");
}
if (!this.getIdentityNumber().matches("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$|^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$")) {
return ValidateResult.fail("身份证号码不正确");
}
if (StringUtils.isEmpty(this.getPhone()) || this.getPhone().trim().length() != 11) {
return ValidateResult.fail("手机号不正确");
}
// if (StringUtils.isEmpty(this.getAddress())) {
// return ValidateResult.fail("住址不正确");
// }
if (StringUtils.isEmpty(this.getNation())) {
return ValidateResult.fail("民族不正确");
}
if (this.getBirthday() == null) {
return ValidateResult.fail("出生日期不能为空");
}
if (StringUtils.isEmpty(this.getOriginAddress())) {
return ValidateResult.fail("身份证地址不正确");
}
if (StringUtils.isEmpty(this.getIssueOrganization())) {
return ValidateResult.fail("发证机关不正确");
}
if (this.getIdentityValidPeriodStart() == null || this.getIdentityValidPeriodEnd() == null) {
return ValidateResult.fail("身份证有效期不正确");
}
if (this.getIdentityValidPeriodStart().getTime() - this.getIdentityValidPeriodEnd().getTime() >= 0) {
return ValidateResult.fail("身份证有效期不正确");
}
if (this.getFrontFileId() == null || this.getFrontFileId() <= 0) {
return ValidateResult.fail("缺少身份证正面照片");
}
if (this.getBackFileId() == null || this.getBackFileId() <= 0) {
return ValidateResult.fail("缺少身份证反面照片");
}
if (StringUtils.isEmpty(this.getCredentialNo())) {
return ValidateResult.fail("驾驶证号码不正确");
}
// if (StringUtils.isEmpty(this.getFileNo())) {
// return ValidateResult.fail("驾驶证档案编号不正确");
// }
if (this.getFirstIssue() == null) {
return ValidateResult.fail("首次发证日期不正确");
}
if (this.getLicenseValidPeriodStart() == null || this.getLicenseValidPeriodEnd() == null) {
return ValidateResult.fail("驾驶证有效期不正确");
}
if (this.getLicenseValidPeriodStart().getTime() - this.getLicenseValidPeriodEnd().getTime() >= 0) {
return ValidateResult.fail("驾驶证有效期不正确");
}
if (this.getMainFileId() == null || this.getMainFileId() <= 0) {
return ValidateResult.fail("缺少驾驶证主页照片");
}
if (this.getSecondFileId() == null || this.getSecondFileId() <= 0) {
return ValidateResult.fail("缺少驾驶证副页照片");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class LoginPo extends Validation {
private String username;
private String password;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class PayingPo extends Validation {
private Integer planningId;
private Integer amount;
private String remark;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class ReturnDepositPo extends Validation {
private Integer contractId;
/** 返还金额 */
private Integer returnAmount;
/** */
private String remark;
}
package com.jair.entity.po;
import lombok.Data;
import java.util.List;
@Data
public class ReturnVehiclePo extends Validation {
private Integer contractId;
/** 是否有行驶证 */
private Integer license;
/** 是否有事故 */
private Integer accident;
/** 事故照片 */
private List<Integer> accidentFiles;
/** 违章罚款 */
private Integer breakRulesAmount;
/** 违章扣分 */
private Integer breakRulesDeduction;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SearchCompanyPo extends Validation {
/** 姓名 */
private String name;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SearchContractPo extends Validation {
/** 合同类型,1车源合同,2司机合同 */
private Integer type;
/** 司机姓名 */
private String driverInfo;
/** 车牌号 */
private String vehicleInfo;
private Integer sourceId;
/** 合同日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDateStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDateEnd;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDateStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDateEnd;
/** 押金状态:-1押金不全,0未返还,1全部返还,2部分返还 */
private List<Integer> depositStatus;
/** 返还押金金额 */
private Integer returnDepositAmountMin;
private Integer returnDepositAmountMax;
private Date createTimeStart;
private Date createTimeEnd;
private Integer status;
private Integer companyId;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SearchDataPo {
Integer parentId;
Integer type;
String name;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SearchDriverPo extends Validation {
/** 身份证号码 */
private String identityNumber;
/** 姓名 */
private String name;
/** 电话 */
private String phone;
/** 现住址 */
private String address;
/** 紧急联系人 */
private String contactName;
/** 紧急联系人电话 */
private String contactPhone;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class SearchPlanningLogPo extends Validation {
/** 合同类型,1租金,2其它费用 */
private Integer type;
/** 合同类型,1付款,2延期 */
private Integer operationType;
/** 合同类型,1车源合同,2司机合同 */
private Integer contractType;
/** 司机姓名 */
private String driverInfo;
/** 车牌号 */
private String vehicleInfo;
/** 计划日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDateStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDateEnd;
/** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createDateStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createDateEnd;
private Integer companyId;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class SearchPlanningPo extends Validation {
/** 合同类型,1租金,2其它费用 */
private Integer type;
private String typeName;
/** 合同类型,1车源合同,2司机合同 */
private Integer contractType;
/** 司机姓名 */
private String driverInfo;
/** 车牌号 */
private String vehicleInfo;
/** 计划日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDateStart;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDateEnd;
private Integer paymentStatus;
private Integer status;
private Integer companyId;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SearchVechiclePo extends Validation {
private String plateNo;
private String brandName;
private String model;
private String environmentalStandards;
private String engineType;
private Integer status;
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.constant.ContractTypeEnum;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SignContractPo extends Validation {
private Integer type = 0;
private Integer vehicleId = 0;
private Integer sourceId = 0;
private Integer driverId = 0;
/** 里程数 */
private Integer odograph = 0;
/** ev里程数 */
private Integer odographEv = 0;
/** 租赁开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate;
/** 租赁结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate;
/** 租赁方式 */
private Integer leaseType;
/** 租赁周期,xx周,xx月 */
private Integer leasePeriod;
/** 应付押金 */
private Integer payableDepositAmount;
/** 已付押金 */
private Integer paidDepositAmount;
/** 周期租金 */
private Integer rentAmount = 0;
/** 第一次已付租金 */
private Integer firstPaidAmount = 0;
private List<Integer> files;
private String remark;
private List<CfgFeePo> fees;
@Override
public ValidateResult validate() {
if (!this.getType().equals(ContractTypeEnum.SOURCE_CONTRACT.getKey()) && !this.getType().equals(ContractTypeEnum.DRIVER_CONTRACT.getKey())) {
return ValidateResult.fail("合同类型不正确");
}
if (this.getOdograph() == null || this.getOdograph() < 0) {
return ValidateResult.fail("请输入正确的里程数");
}
if (this.getStartDate() == null) {
return ValidateResult.fail("请选择合同开始日期");
}
// if (this.getStartDate().getTime() - this.getEndDate().getTime() >= 0) {
// return ValidateResult.fail("合约日期选择不正确");
// }
// if (this.getEndDate().getTime() - new Date().getTime() <= 0) {
// return ValidateResult.fail("合约结束日期选择不正确");
// }
if (this.getLeaseType() == null) {
return ValidateResult.fail("请输入正确的出租类型");
}
if (this.getLeasePeriod() == null || this.getLeasePeriod() <= 0) {
return ValidateResult.fail("请输入正确的出租周期");
}
if (this.getPayableDepositAmount() == null || this.getPayableDepositAmount() < 0) {
return ValidateResult.fail("请输入正确的应付押金金额");
}
if (this.getPaidDepositAmount() == null || this.getPaidDepositAmount() < 0) {
return ValidateResult.fail("请输入正确的已付押金金额");
}
if (this.getRentAmount() == null || this.getRentAmount() <= 0) {
return ValidateResult.fail("请输入正确周期租金");
}
if (this.getFirstPaidAmount() == null || this.getFirstPaidAmount() <= 0) {
return ValidateResult.fail("请输入正确首付租金");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SourcePo extends Validation {
private Integer id;
/** 车源名称 */
private String name;
/** 地址 */
private String address;
/** 联系人 */
private String contactName;
/** 电话 */
private String contactPhone;
/** */
private Integer status;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class SysDataPo extends Validation {
/** */
private Integer parentId;
/** 编码 */
private String code;
/** 名称 */
private String name;
/** 扩展 */
private String extend;
/** @DataTypeEnum */
private Integer type;
}
package com.jair.entity.po;
import lombok.Data;
@Data
public class TerminateContractPo extends Validation {
private Integer contractId;
private Integer deletePlanning;
}
package com.jair.entity.po;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class UpdateAccountPo extends Validation {
private Integer id;
/** 姓名 */
private String realName;
/** 电话 */
private String phone;
/** 地址 */
private String address;
@Override
public ValidateResult validate() {
if (this.getId() == null || this.getId() <= 0) {
return ValidateResult.fail("未知帐号");
}
if (StringUtils.isEmpty(this.getRealName()) || this.getRealName().trim().length() < 2) {
return ValidateResult.fail("姓名长度不能小于2位");
}
if (StringUtils.isEmpty(this.getPhone()) || this.getPhone().trim().length() != 11) {
return ValidateResult.fail("电话输入不正确");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class UpdateAccountStatusPo extends Validation {
private Integer id;
private Integer status;
@Override
public ValidateResult validate() {
if (this.getId() == null || this.getId() <= 0) {
return ValidateResult.fail("未知帐号");
}
if (this.getStatus() != 1 && this.getStatus() != 0) {
return ValidateResult.fail("状态不正确");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class UpdateContractPo extends Validation {
private Integer contractId;
/** 里程数 */
private Integer odograph;
/** ev里程数 */
private Integer odographEv;
/** 租赁开始日期 */
private Date startDate;
/** 租赁结束日期 */
private Date endDate;
/** 租赁方式 */
private Integer leaseType;
/** 押金状态:@DepositStatusEnum */
private Integer depositStatus;
/** 应付押金 */
private Integer payableDepositAmount;
/** 已付押金 */
private Integer paidDepositAmount;
/** 返还押金金额 */
private Integer returnDepositAmount;
/** 月租金 */
private Integer rentAmount;
private String remark;
private List<Integer> files;
@Override
public ValidateResult validate() {
if (this.getOdograph() < 0) {
return ValidateResult.fail("请输入正确的里程数");
}
if (this.getStartDate() == null || this.getEndDate() == null) {
return ValidateResult.fail("请选择合约日期");
}
if (this.getStartDate().getTime() - this.getEndDate().getTime() >= 0) {
return ValidateResult.fail("合约日期选择不正确");
}
if (this.getEndDate().getTime() - new Date().getTime() <= 0) {
return ValidateResult.fail("合约结束日期选择不正确");
}
if (this.getPayableDepositAmount() == null || this.getPayableDepositAmount() < 0) {
return ValidateResult.fail("请输入正确的应付押金金额");
}
if (this.getPaidDepositAmount() == null || this.getPaidDepositAmount() < 0) {
return ValidateResult.fail("请输入正确的已付押金金额");
}
if (this.getRentAmount() == null || this.getRentAmount() <= 0) {
return ValidateResult.fail("请输入正确月租金");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class UpdatePasswordPo extends Validation {
private Integer id;
/** 密码 */
private String password;
@Override
public ValidateResult validate() {
if (this.getId() == null || this.getId() <= 0) {
return ValidateResult.fail("未知帐号");
}
if (StringUtils.isEmpty(this.getPassword()) || this.getPassword().length() < 6) {
return ValidateResult.fail("密码长度不能小于6位");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.Date;
@Data
public class UpdateVehiclePo extends Validation {
private Integer id;
/** 品牌 */
private String brandName;
/** 型号 */
private String model;
/** 排量 */
private String displacement;
/** 颜色 */
private String color;
/** 环保标准 */
private String environmentalStandards;
/** 动力类型 */
private String engineType;
/** 车牌号码 */
private String plateNo;
/** 车辆类型:小型轿车 */
private String type;
/** 所有人 */
private String owner;
/** 住址 */
private String address;
/** 使用性质:非营运 */
private String useCharacter;
/** 型号 */
private String licenseModel;
/** 识别代号 */
private String vin;
/** 发动机号码 */
private String engineNo;
/** 注册日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date registerDate;
/** 发证日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date issueDate;
/** 核载人数 */
private String approvedPerson;
/** 总质量 */
private String weight;
/** 尺寸 */
private String outlineSize;
/** 行驶证主页照片 */
private Integer mainFileId;
/** 行驶证副页照片 */
private Integer secondFileId;
private String remark;
@Override
public ValidateResult validate() {
if (this.getId() == null || this.getId() <= 0) {
return ValidateResult.fail("车辆id不正确");
}
if (StringUtils.isEmpty(this.getPlateNo())) {
return ValidateResult.fail("请输入完整车牌号");
}
this.setPlateNo(this.getPlateNo().toUpperCase());
if (!this.getPlateNo().matches("^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$")) {
return ValidateResult.fail("车牌号格式不正确");
}
return ValidateResult.succeed(this);
}
}
package com.jair.entity.po;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@Slf4j
public class ValidateResult {
private Integer code;
private String data;
public boolean isSucceed() {
return code == 0;
}
public static ValidateResult fail(String data) {
ValidateResult result = new ValidateResult();
result.setCode(1);
result.setData(data);
return result;
}
public static ValidateResult succeed(Object object) {
log.info("数据校验通过:{}", object.toString());
ValidateResult result = new ValidateResult();
result.setCode(0);
result.setData("验证通过");
return result;
}
}
package com.jair.entity.po;
public abstract class Validation {
public ValidateResult validate() {
return null;
}
}
package com.jair.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jair.entity.bo.Account;
import lombok.Data;
import java.util.Date;
@Data
public class CompanyVo {
/**
* 公司id
*/
private Integer id;
/**
* 公司名称
*/
private String name;
/**
* 简称
*/
private String abbr;
/**
* 地址
*/
private String address;
/**
* 联系人
*/
private String contactName;
/**
* 联系电话
*/
private String contactPhone;
/**
* 省
*/
private String province;
/**
* 市
*/
private String city;
/**
* 区
*/
private String district;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expiredDate;
/**
* 状态
*/
private Integer status;
private Integer level;
private Account account;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.Source;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
public class ContractVo implements Serializable {
private Integer id;
/** 合同类型,1车源合同,2司机合同 */
private Integer type;
private String code;
/** 车辆信息 */
private Integer vehicleId;
private VehicleVo vehicleVo;
/** 车源信息 */
private Integer sourceId;
private Source sourceVo;
/** 司机信息 */
private Integer driverId;
private DriverVo driverVo;
/** 里程数 */
private Integer odograph;
/** ev里程数 */
private Integer odographEv;
/** 租赁开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate;
/** 租赁结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate;
/** 租赁方式 */
private Integer leaseType;
/** 押金状态:@DepositStatusEnum */
private Integer depositStatus;
/** 应付押金 */
private Integer payableDepositAmount;
/** 已付押金 */
private Integer paidDepositAmount;
/** 返还押金金额 */
private Integer returnDepositAmount;
/** 租金 */
private Integer rentAmount;
/** 状态:1正常有效,0已结束 */
private Integer status;
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
/** 是否存在有效(车源或司机)合同 */
private Integer anotherContract = 0;
private List<AttFile> files;
}
package com.jair.entity.vo;
import lombok.Data;
@Data
public class DashboardVo {
/** 全部司机数量 */
private Integer allDriverCount;
/** 签约中司机数量 */
private Integer signedDriverCount;
/** 全部车辆数量 */
private Integer allVehicleCount;
/** 签约中车辆数量 */
private Integer signedVehicleCount;
/** 本月计划 回款 */
private Integer currentMonthPlanAmount;
/** 本月实际 回款 */
private Integer currentMonthActualAmount;
/** 今日计划 回款 */
private Integer todayPlanAmount;
/** 今日实际 回款 */
private Integer todayActualAmount;
/** 总合同数量 */
private Integer allContract;
/** 执行中合同数量 */
private Integer validContract;
/** 本月新租 */
private Integer currentMonthContract;
/** 上月新租 */
private Integer lastMonthContract;
/** 今日新租 */
private Integer todayContract;
/** 昨日新租 */
private Integer yesterdayContract;
}
package com.jair.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jair.entity.bo.AttFile;
import lombok.Data;
import java.util.Date;
@Data
public class DriverVo {
private Integer id;
/** 身份证号码 */
private String identityNumber;
/** 姓名 */
private String name;
/** 性别 */
private String gender;
/** 电话 */
private String phone;
/** 现住址 */
private String address;
/** 紧急联系人 */
private String contactName;
/** 紧急联系人电话 */
private String contactPhone;
/** 是否有网约车执照:0无,1有 */
private Integer serviceLicense;
// 身份证信息
/** 民族 */
private String nation;
/** 出生日期 */
private Date birthday;
/** 身份证地址 */
private String originAddress;
/** 发证机关 */
private String issueOrganization;
/** 身份证 有效期-起 */
private Date identityValidPeriodStart;
/** 身份证 有效期-止 */
private Date identityValidPeriodEnd;
/** 身份证 正面照片 */
private AttFile frontFile;
// private Integer frontFileId;
// private String frontFileUrl;
/** 身份证 反面照片 */
private AttFile backFile;
// private Integer backFileId;
// private String backFileUrl;
// 驾驶证信息
/** 驾驶证号 */
private String credentialNo;
/** 档案编号 */
private String fileNo;
/** 首次发证日期 */
private Date firstIssue;
/** 驾照 准驾车型 */
private String drivingClass;
/** 驾照 有效期-起 */
private Date licenseValidPeriodStart;
/** 驾照 有效期-止 */
private Date licenseValidPeriodEnd;
/** 驾照 主页照片 */
private AttFile mainFile;
// private Integer mainFileId;
// private String mainFileUrl;
/** 驾照 副页照片 */
private AttFile secondFile;
// private Integer secondFileId;
// private String secondFileUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 驾驶证
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DrivingLicenseVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 姓名 */
private String name;
/** 驾驶证号 */
private String credentialNo;
/** 档案编号 */
private String fileNo;
/** 国籍 */
private String country;
/** 住址 */
private String address;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
/** 首次发证日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date firstIssue;
/** 准驾车型 */
@TableField("class")
private String drivingClass;
/** 有效期-起 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date validPeriodStart;
/** 有效期-止 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date validPeriodEnd;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class FeePlanningVo implements Serializable {
private Integer id;
/** 费用类型 */
private Integer type;
/** 费用名称 */
private String name;
/** 合同ID */
private Integer contractId;
/** 合同类型 */
private Integer contractType;
/** 计划执行日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDate;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date delayDate;
/** 应付金额 */
private Integer payableAmount;
/** 已付金额 */
private Integer paidAmount;
/** 状态:0未付,1已付部分,2已付全部 */
private Integer paymentStatus;
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
private Integer status;
private String contractCode;
private Integer driverId;
private String driverName;
private Integer vehicleId;
private String plateNo;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class IdentityCardVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 姓名 */
private String name;
/** 性别 */
private String gender;
/** 民族 */
private String nation;
private String identityNumber;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
/** 身份证地址 */
private String originAddress;
/** 发证机关 */
private String issueOrganization;
/** 有效期-起 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date validPeriodStart;
/** 有效期-止 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date validPeriodEnd;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
@Data
public class ModelVo {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String code;
private String name;
private String extend;
private String type;
private Integer brandId;
private String brandCode;
private String brandName;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author Jair
* @since 2020-10-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class PlanningOperationLogVo implements Serializable {
private static final long serialVersionUID = 1L;
/** 合同ID */
private Integer contractId;
/** 合同类型 */
private Integer planningId;
/** @PlanningLogActionEnum */
private Integer type;
/** @PlanningLogActionEnum */
private String action;
/** 金额 */
private Integer amount;
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Integer createById;
private String createByName;
private Integer companyId;
private String planName;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date planDate;
private Integer payableAmount;
private String plateNo;
private String brandName;
private String model;
private String driverName;
private String driverPhone;
private String driverId;
}
package com.jair.entity.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 行驶证
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Data
public class VehicleLicenseDetectVo implements Serializable {
/** 车牌号 */
private String plateNo;
/** 识别代号 */
private String vin;
/** 发动机号码 */
private String engineNo;
/** 车辆类型:小型轿车 */
private String type;
/** 使用性质:非营运 */
private String useCharacter;
/** 型号 */
private String licenseModel;
/** 所有人 */
private String owner;
/** 住址 */
private String address;
/** 注册日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date registerDate;
/** 发证日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date issueDate;
/** 核载人数 */
private String approvedPerson;
/** 总质量 */
private String weight;
/** 尺寸 */
private String outlineSize;
}
package com.jair.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.Date;
@Data
public class VehicleVo {
private Integer id;
private Integer licenseId;
/** 品牌 */
private Integer brandId;
/** 品牌 */
private String brandName;
/** 型号 */
private String model;
/** 排量 */
private String displacement;
/** 颜色 */
private String color;
/** 环保标准 */
private String environmentalStandards;
/** 动力类型 */
private String engineType;
/** 状态 */
private Integer status;
/** 车牌号码 */
private String plateNo;
/** 车辆类型:小型轿车 */
private String type;
/** 所有人 */
private String owner;
/** 住址 */
private String address;
/** 使用性质:非营运 */
private String useCharacter;
/** 型号 */
private String licenseModel;
/** 识别代号 */
private String vin;
/** 发动机号码 */
private String engineNo;
/** 注册日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date registerDate;
/** 发证日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date issueDate;
/** 核载人数 */
private String approvedPerson;
/** 总质量 */
private String weight;
/** 尺寸 */
private String outlineSize;
/** 行驶证主页照片 */
private Integer mainFileId;
/** 行驶证主页照片 url */
private String mainFileUrl;
/** 行驶证副页照片 */
private Integer secondFileId;
/** 行驶证副页照片 url */
private String secondFileUrl;
private String remark;
private Integer sourceStatus;
private Integer driverStatus;
}
package com.jair.mapper;
import com.jair.entity.bo.Account;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 帐号 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface AccountMapper extends BaseMapper<Account> {
}
package com.jair.mapper;
import com.jair.entity.bo.AttFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface AttFileMapper extends BaseMapper<AttFile> {
}
package com.jair.mapper;
import com.jair.entity.bo.CfgData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface CfgDataMapper extends BaseMapper<CfgData> {
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jair.entity.bo.CfgData;
import com.jair.entity.bo.CfgFee;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface CfgFeeMapper extends BaseMapper<CfgFee> {
}
package com.jair.mapper;
import com.jair.entity.bo.Company;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 企业主体 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface CompanyMapper extends BaseMapper<Company> {
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.Contract;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jair.entity.po.SearchContractPo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface ContractMapper extends BaseMapper<Contract> {
IPage<Contract> queryDriverContracts(Page page, @Param("searcher") SearchContractPo searcher);
}
package com.jair.mapper;
import com.jair.entity.bo.ContractOperationLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface ContractOperationLogMapper extends BaseMapper<ContractOperationLog> {
}
package com.jair.mapper;
import com.jair.entity.bo.ContractReturnVehicleAttachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface ContractReturnVehicleAttachmentMapper extends BaseMapper<ContractReturnVehicleAttachment> {
}
package com.jair.mapper;
import com.jair.entity.bo.ContractReturnVehicle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface ContractReturnVehicleMapper extends BaseMapper<ContractReturnVehicle> {
}
package com.jair.mapper;
import com.jair.entity.bo.ContractSignAttachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface ContractSignAttachmentMapper extends BaseMapper<ContractSignAttachment> {
}
package com.jair.mapper;
import com.jair.entity.bo.Driver;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jair.entity.common.TokenInfo;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface DriverMapper extends BaseMapper<Driver> {
}
package com.jair.mapper;
import com.jair.entity.bo.DrivingLicense;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 驾驶证 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface DrivingLicenseMapper extends BaseMapper<DrivingLicense> {
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.FeePlanning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SearchPlanningPo;
import com.jair.entity.vo.FeePlanningVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-10-09
*/
public interface FeePlanningMapper extends BaseMapper<FeePlanning> {
void disablePlanningByContractId(Integer contractId);
IPage<FeePlanningVo> getDriverPlannings(Page page, @Param("searcher") SearchPlanningPo searcher);
Integer getPlanAmountByPlanDate(@Param("companyId") Integer companyId, @Param("date") String date);
Integer getActualAmountByCreateTime(@Param("companyId") Integer companyId, @Param("date") String date);
}
package com.jair.mapper;
import com.jair.entity.bo.IdentityCard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IdentityCardMapper extends BaseMapper<IdentityCard> {
}
package com.jair.mapper;
import com.jair.entity.bo.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface MenuMapper extends BaseMapper<Menu> {
}
package com.jair.mapper;
import com.jair.entity.bo.Motorcade;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 车队表 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface MotorcadeMapper extends BaseMapper<Motorcade> {
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.Contract;
import com.jair.entity.bo.PlanningOperationLog;
import com.jair.entity.po.SearchContractPo;
import com.jair.entity.po.SearchPlanningLogPo;
import com.jair.entity.vo.PlanningOperationLogVo;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Jair
* @since 2020-10-09
*/
public interface PlanningOperationLogMapper extends BaseMapper<PlanningOperationLog> {
IPage<PlanningOperationLogVo> queryLogs(Page page, @Param("searcher") SearchPlanningLogPo searcher);
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.Sequence;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.vo.VehicleVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 车辆信息 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface SequenceMapper extends BaseMapper<Sequence> {
}
package com.jair.mapper;
import com.jair.entity.bo.Source;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 车源信息 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface SourceMapper extends BaseMapper<Source> {
}
package com.jair.mapper;
import com.jair.entity.bo.VehicleLicense;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 行驶证 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface VehicleLicenseMapper extends BaseMapper<VehicleLicense> {
}
package com.jair.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.vo.VehicleVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 车辆信息 Mapper 接口
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface VehicleMapper extends BaseMapper<Vehicle> {
List<VehicleVo> listNoSourceContractVehicles(Integer companyId);
List<VehicleVo> listAllowRentVehicles(Integer companyId);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Account;
import com.jair.entity.bo.Company;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
* <p>
* 帐号 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IAccountService extends IService<Account> {
ResultVo login(HttpServletRequest request, HttpServletResponse response, LoginPo loginPo);
ResultVo loginSuccess(HttpServletRequest request, HttpServletResponse response, Account account, Company company);
String generateToken(Account account, Date date);
TokenInfo getTokenInfo(HttpServletRequest request);
ResultVo createAccount(TokenInfo tokenInfo, CreateAccountPo createAccountPo);
ResultVo updateAccount(TokenInfo tokenInfo, UpdateAccountPo updateAccountPo);
ResultVo updatePassword(TokenInfo tokenInfo, UpdatePasswordPo updatePasswordPo);
ResultVo updateStatus(TokenInfo tokenInfo, UpdateAccountStatusPo updateStatusPo);
Account getAccountById(Integer accountId, Integer companyId);
Account getAccountById(Integer accountId);
boolean isUsernameExists(String username);
boolean isPhoneExists(Integer accountId, String phone);
List<Account> listAccounts(TokenInfo tokenInfo, Integer companyId, Integer accountType);
Account getMainAccount(TokenInfo tokenInfo, Integer companyId);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.AttFile;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.text.ParseException;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IAnalyticsService {
ResultVo dashboard(TokenInfo tokenInfo) throws ParseException;
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.AttFile;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IAttFileService extends IService<AttFile> {
ResultVo upload(TokenInfo tokenInfo, @RequestParam("file") MultipartFile multipartFile) throws Exception;
AttFile getAttFileById(Integer companyId, Integer id);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Company;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CompanyPo;
import com.jair.entity.po.SearchCompanyPo;
/**
* <p>
* 企业主体 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface ICompanyService extends IService<Company> {
ResultVo createCompany(TokenInfo tokenInfo, CompanyPo companyPo);
ResultVo updateExpiredDate(TokenInfo tokenInfo, CompanyPo companyPo);
ResultVo updateStatus(TokenInfo tokenInfo, CompanyPo companyPo);
ResultVo updateCompany(TokenInfo tokenInfo, CompanyPo companyPo);
boolean isCompanyNameExists(Integer id, String companyName);
boolean isCompanyAbbrExists(Integer id, String abbr);
ResultVo listCompanys(TokenInfo tokenInfo, PageInfo<SearchCompanyPo> pageInfo);
ResultVo myCompany(TokenInfo tokenInfo);
void checkExpiredCompanys();
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.ContractOperationLog;
import com.jair.entity.common.TokenInfo;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IContractOperationLogService extends IService<ContractOperationLog> {
void createLog(TokenInfo tokenInfo, Integer type, Integer contractId, String action, String content);
}
package com.jair.service;
import com.jair.entity.bo.ContractReturnVehicleAttachment;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface IContractReturnVehicleAttachmentService extends IService<ContractReturnVehicleAttachment> {
}
package com.jair.service;
import com.jair.entity.bo.ContractReturnVehicle;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface IContractReturnVehicleService extends IService<ContractReturnVehicle> {
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Contract;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IContractService extends IService<Contract> {
/** 合同列表 */
ResultVo listContracts(TokenInfo tokenInfo, PageInfo<SearchContractPo> pageInfo);
/** 获取过期合同日志信息 */
ResultVo getContractLogs(TokenInfo tokenInfo, Integer contractId);
/** 新签合同 */
ResultVo signContract(TokenInfo tokenInfo, SignContractPo signContractPo) throws Exception;
/** 修改合同 */
ResultVo updateContract(TokenInfo tokenInfo, UpdateContractPo updateContractPo);
/** 返还押金 */
ResultVo returnDeposit(TokenInfo tokenInfo, ReturnDepositPo returnDepositPo);
/** 中止合同 */
ResultVo terminateContract(TokenInfo tokenInfo, TerminateContractPo terminatePo);
/** 添加交车信息 */
ResultVo returnVehicle(TokenInfo tokenInfo, ReturnVehiclePo returnVehiclePo);
/** 检查车辆是否在存生效中的合同 */
boolean checkInEffectContract(Integer vehicleId, Integer type);
/** 获取合同信息 */
ResultVo getContractById(TokenInfo tokenInfo, Integer contractId);
Contract getContractById(Integer companyId, Integer contractId);
/** 获取合同信息 */
Contract getContractByType(Integer companyId, Integer type, Integer id);
String genContractCode(Integer type);
/** 获取过期合同,修改合同状态为0 */
void checkEndedContracts();
/** 统计接口 */
/** 根据创建时间获取合同数量 */
Integer getContractCountByCreateTime(TokenInfo tokenInfo, String createTime);
/** 获取全部合同数量 */
Integer getAllContractCount(TokenInfo tokenInfo);
/** 获取执行中合同数量 */
Integer getValidContractCount(TokenInfo tokenInfo);
/** 获取签约中司机数量 */
Integer getSignedDriverCount(TokenInfo tokenInfo);
/** 获取签约中车辆数量 */
Integer getSignedVehicleCount(TokenInfo tokenInfo);
}
package com.jair.service;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.ContractSignAttachment;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IContractSignAttachmentService extends IService<ContractSignAttachment> {
List<AttFile> getFilesByContractId(Integer contractId);
void deleteFilesByContractId(Integer contractId);
void updateContractFiles(List<Integer> files, Integer contractId);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.CfgData;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SearchDataPo;
import com.jair.entity.po.SysDataPo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IDataService extends IService<CfgData> {
ResultVo listEnvironmentalStandards(TokenInfo tokenInfo);
ResultVo listUseCharacters(TokenInfo tokenInfo);
ResultVo listColors(TokenInfo tokenInfo);
ResultVo listEngineTypes(TokenInfo tokenInfo);
ResultVo listVehicleTypes(TokenInfo tokenInfo);
ResultVo listBrands(TokenInfo tokenInfo);
ResultVo listModels(TokenInfo tokenInfo, SearchDataPo searchPo);
List<CfgData> listDatas(Integer companyId, Integer type, Integer parentId);
CfgData getDataById(Integer companyId, Integer dataId);
ResultVo createData(TokenInfo tokenInfo, SysDataPo dataPo);
Boolean isDataNameExists(Integer companyId, Integer type, Integer parentId, String name);
Integer getBrandIdByName(TokenInfo tokenInfo, String name);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Driver;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.DriverPo;
import com.jair.entity.po.SearchDriverPo;
import com.jair.entity.vo.DriverVo;
import com.jair.entity.vo.VehicleVo;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IDriverService extends IService<Driver> {
/** 司机列表 */
ResultVo listDrivers(TokenInfo tokenInfo, PageInfo<SearchDriverPo> pageInfo);
ResultVo listAllDrivers(TokenInfo tokenInfo);
/** 创建司机 */
ResultVo createDriver(TokenInfo tokenInfo, DriverPo driverPo) throws Exception;
/** 修改司机信息 */
ResultVo updateDriver(TokenInfo tokenInfo, DriverPo driverPo) throws Exception;
/** 检查车牌号是否存在 */
boolean isDriverExists(Integer companyId, Integer driverId, String identityNumber);
/** 根据id获取司机 */
ResultVo getDriverById(TokenInfo tokenInfo, Integer driverId);
Driver getDriverById(Integer companyId, Integer driverId);
/** 填充身份证信息 */
DriverVo fillIdentityCardInfo(TokenInfo tokenInfo, DriverVo driverVo, Integer identityId);
/** 填充驾驶证信息 */
DriverVo fillDrivingLicenseInfo(TokenInfo tokenInfo, DriverVo driverVo, Integer licenseId);
DriverVo translateDriverToVo(TokenInfo tokenInfo, Driver driver);
/** 统计接口 */
/** 获取所有司机数量 */
Integer getAllDriverCount(TokenInfo tokenInfo);
}
package com.jair.service;
import com.jair.entity.bo.DrivingLicense;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 驾驶证 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IDrivingLicenseService extends IService<DrivingLicense> {
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.CfgData;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SearchDataPo;
import com.jair.entity.po.SysDataPo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IFeeService extends IService<CfgFee> {
ResultVo list(TokenInfo tokenInfo, Integer status);
ResultVo create(TokenInfo tokenInfo, CfgFee fee);
ResultVo disable(TokenInfo tokenInfo, Integer feeId);
ResultVo enable(TokenInfo tokenInfo, Integer feeId);
CfgFee getFeeById(Integer companyId, Integer feeId);
}
package com.jair.service;
import com.jair.entity.bo.IdentityCard;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IIdentityCardService extends IService<IdentityCard> {
}
package com.jair.service;
import com.jair.entity.bo.Menu;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
public interface IMenuService extends IService<Menu> {
}
package com.jair.service;
import com.jair.entity.bo.Motorcade;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 车队表 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IMotorcadeService extends IService<Motorcade> {
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.bo.Contract;
import com.jair.entity.bo.FeePlanning;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IPlanningService extends IService<FeePlanning> {
ResultVo listPlanning(TokenInfo tokenInfo, PageInfo<SearchPlanningPo> pageInfo);
/** 获取费用计划 */
ResultVo listPlanningByContractId(TokenInfo tokenInfo, Integer contractId, Integer type);
void saveFeePlanning(TokenInfo tokenInfo, Contract contract, List<CfgFeePo> fees) throws Exception;
void saveRentPlanning(TokenInfo tokenInfo, Contract contract, Integer firstPaidAmount) throws Exception;
void saveDepositPlanning(TokenInfo tokenInfo, Contract contract) throws Exception;
void disablePlanningByContractId(Integer contractId);
/** 费用付款 */
ResultVo paying(TokenInfo tokenInfo, PayingPo payingPo) throws Exception;
/** 延期 */
ResultVo delay(TokenInfo tokenInfo, DelayPo delayPo) throws Exception;
ResultVo listLogs(TokenInfo tokenInfo, PageInfo<SearchPlanningLogPo> pageInfo);
/** 统计接口 */
/** 应收 */
Integer getPlanAmountByPlanDate(TokenInfo tokenInfo, String date);
/** 已收 */
Integer getActualAmountByCreateTime(TokenInfo tokenInfo, String date);
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Sequence;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CreateVehiclePo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.po.UpdateVehiclePo;
import com.jair.entity.vo.VehicleVo;
/**
* @author Jair
* @since 2020-08-25
*/
public interface ISequenceService extends IService<Sequence> {
Integer getSequence();
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Source;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SourcePo;
/**
* <p>
* 车源信息 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface ISourceService extends IService<Source> {
ResultVo createSource(TokenInfo tokenInfo, SourcePo sourcePo);
ResultVo updateSource(TokenInfo tokenInfo, SourcePo sourcePo);
ResultVo listSources(TokenInfo tokenInfo, SourcePo sourcePo);
boolean isSourceNameExists(Integer companyId, Integer sourceId, String sourceName);
Source getSourceById(Integer companyId, Integer sourceId);
ResultVo updateSourceStatus(TokenInfo tokenInfo, SourcePo sourcePo);
}
package com.jair.service;
import com.jair.entity.bo.VehicleLicense;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 行驶证 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IVehicleLicenseService extends IService<VehicleLicense> {
}
package com.jair.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CreateVehiclePo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.po.UpdateVehiclePo;
import com.jair.entity.vo.VehicleVo;
/**
* <p>
* 车辆信息 服务类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
public interface IVehicleService extends IService<Vehicle> {
/** 创建车辆 */
ResultVo createVehicle(TokenInfo tokenInfo, CreateVehiclePo vehiclePo);
ResultVo updateVehicle(TokenInfo tokenInfo, UpdateVehiclePo vehiclePo);
/** 车辆列表 */
ResultVo listVehicles(TokenInfo tokenInfo, PageInfo<SearchVechiclePo> pageInfo);
/** 车辆列表 无车源合同 */
ResultVo listNoSourceContractVehicles(TokenInfo tokenInfo);
/** 车辆列表 可以出租给司机的列表 */
ResultVo listAllowRentVehicles(TokenInfo tokenInfo);
/** 归还车辆 */
ResultVo returnVehicle(TokenInfo tokenInfo, Integer vehicleId);
/** 检查车牌号是否存在 */
boolean isPlateNoExists(Integer companyId, Integer vehicleId, String plateNo);
/** 根据id获取车辆 */
ResultVo getVehicleById(TokenInfo tokenInfo, Integer vehicleId);
Vehicle getVehicleById(Integer companyId, Integer vehicleId);
VehicleVo translateVehicleToVo(TokenInfo tokenInfo, Vehicle vehicle);
/** 统计接口 */
/** 获取所有车辆数量 */
Integer getAllVehicleCount(TokenInfo tokenInfo);
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.Account;
import com.jair.entity.bo.Company;
import com.jair.entity.bo.Menu;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.*;
import com.jair.mapper.AccountMapper;
import com.jair.service.IAccountService;
import com.jair.service.ICompanyService;
import com.jair.service.IMenuService;
import com.jair.util.BeanUtil;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.security.ConcurrentMessageDigest;
import org.apache.tomcat.util.security.MD5Encoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
* <p>
* 帐号 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
@Slf4j
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountService {
@Autowired
private ICompanyService companyService;
@Autowired
private IMenuService menuService;
@Override
public ResultVo login(HttpServletRequest request, HttpServletResponse response, LoginPo loginPo) {
if (loginPo == null) {
return ResultVo.businessError("请输入用户名、密码");
}
if (StringUtils.isEmpty(loginPo.getUsername())) {
return ResultVo.businessError("请输入用户名");
}
if (StringUtils.isEmpty(loginPo.getPassword())) {
return ResultVo.businessError("请输入密码");
}
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getUsername, loginPo.getUsername());
Account account = this.getOne(queryWrapper);
if (account == null) {
return ResultVo.businessError("用户名不存在");
}
if (!account.getPassword().equalsIgnoreCase(loginPo.getPassword())) {
return ResultVo.businessError("密码不正确");
}
if (account.getStatus() == 0) {
return ResultVo.businessError("该帐号已停用");
}
if (account.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return loginSuccess(request, response, account, null);
}
Company company = companyService.getById(account.getCompanyId());
if (company == null) {
return ResultVo.businessError("未找到该帐号关联的企业");
}
if (company.getStatus() == 0) {
return ResultVo.businessError("该企业已停用");
}
return loginSuccess(request, response, account, company);
}
@Override
public ResultVo loginSuccess(HttpServletRequest request, HttpServletResponse response, Account account, Company company) {
Date expiredDate = DateUtil.getAddDayTime(7);
String token = generateToken(account, expiredDate);
account.setToken(token);
account.setTokenExpiredTime(expiredDate);
this.updateById(account);
TokenInfo tokenInfo = BeanUtil.transform(account, TokenInfo.class);
if (company != null) {
tokenInfo.setCompanyId(company.getId());
tokenInfo.setCompanyName(company.getName());
tokenInfo.setAbbr(company.getAbbr());
}
tokenInfo.setMenus(this.getAccountMenus(account.getType()));
response.addHeader("Token", token);
return ResultVo.success(tokenInfo);
}
private String getAccountMenus(Integer accountType) {
QueryWrapper<Menu> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Menu::getAccountType, accountType);
Menu menu = menuService.getOne(queryWrapper);
if (menu == null) {
return null;
}
return menu.getMenus();
}
@Override
public String generateToken(Account account, Date date) {
String key = account.getUsername() + DateUtil.format2Datetime(date);
return MD5Encoder.encode(ConcurrentMessageDigest.digestMD5(key.getBytes()));
}
@Override
public TokenInfo getTokenInfo(HttpServletRequest request) {
String authHeader = request.getHeader("Token");
//请求头不带Token
if (StringUtils.isEmpty(authHeader) || !authHeader.startsWith("Bearer ")) {
log.error("header is empty");
return null;
}
String token = authHeader.substring("Bearer ".length());
if (StringUtils.isEmpty(token)) {
log.error("token is empty");
return null;
}
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getToken, token);
Account account = this.getOne(queryWrapper);
if (account == null) {
log.error("not found account by token,{}", token);
return null;
}
if (account.getTokenExpiredTime().getTime() < new Date().getTime()) {
log.error("token expired time invalid,{}", token);
return null;
}
if (account.getStatus() == 0) {
log.error("account is disabled,{}", token);
return null;
}
TokenInfo tokenInfo = BeanUtil.transform(account, TokenInfo.class);
// Company company = companyMapper.selectById(account.getCompanyId());
// if (company != null) {
// tokenInfo.setCompanyId(company.getId());
// tokenInfo.setCompanyName(company.getName());
// }
return tokenInfo;
}
@Override
public List<Account> listAccounts(TokenInfo tokenInfo, Integer companyId, Integer accountType) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getCompanyId, companyId);
if (accountType != null)
queryWrapper.lambda().eq(Account::getType, accountType);
queryWrapper.orderByAsc("type", "id");
return this.list(queryWrapper);
}
@Override
public Account getMainAccount(TokenInfo tokenInfo, Integer companyId) {
List<Account> accounts = this.listAccounts(tokenInfo, companyId, AccountTypeEnum.MAIN.getKey());
if (accounts == null || accounts.isEmpty()) {
return null;
}
return accounts.get(0);
}
@Override
public ResultVo createAccount(TokenInfo tokenInfo, CreateAccountPo createAccountPo) {
ValidateResult validate = createAccountPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
// 非管理员,并且添加的帐号不是本企业
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
if (!tokenInfo.getCompanyId().equals(createAccountPo.getCompanyId())) {
return ResultVo.businessError("非管理员,并且添加的帐号不是本企业");
}
}
Company company = this.companyService.getById(createAccountPo.getCompanyId());
if (company == null) {
return ResultVo.businessError("未知的企业");
}
if (createAccountPo.getType().equals(AccountTypeEnum.MAIN.getKey())) {
// 非管理员不允许添加主帐号
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("非管理员不允许添加主帐号");
}
// 每个企业只能存在一个主帐号
List<Account> mainAccounts = listAccounts(tokenInfo, company.getId(), AccountTypeEnum.MAIN.getKey());
if (mainAccounts != null && mainAccounts.size() > 0) {
return ResultVo.businessError("每个企业只能存在一个主帐号");
}
} else {
List<Account> subAccounts = this.listAccounts(tokenInfo, company.getId(), AccountTypeEnum.SUB.getKey());
int accountSize = 0;
if (company.getLevel() == 1) {
accountSize = 5;
} else if (company.getLevel() == 2) {
accountSize = 10;
} else if (company.getLevel() == 3) {
accountSize = 50;
}
if (subAccounts != null && subAccounts.size() >= accountSize) {
return ResultVo.businessError("企业子帐号数量超过最大限度" + accountSize);
}
}
String accountName = createAccountPo.getUsername() + "@" + company.getAbbr();
if (this.isUsernameExists(accountName)) {
return ResultVo.businessError("帐号已经存在");
}
if (this.isPhoneExists(null, createAccountPo.getPhone())) {
return ResultVo.businessError("电话号码已经存在");
}
String password = MD5Encoder.encode(ConcurrentMessageDigest.digestMD5(createAccountPo.getPassword().getBytes()));
Account account = BeanUtil.transform(createAccountPo, Account.class);
account.setUsername(accountName);
account.setPassword(password);
account.setCreateTime(new Date());
account.setCreateById(tokenInfo.getId());
account.setCreateByName(tokenInfo.getRealName());
account.setCompanyId(company.getId());
account.setCompanyName(company.getName());
account.setStatus(1);
this.save(account);
return ResultVo.success(account);
}
@Override
public ResultVo updateAccount(TokenInfo tokenInfo, UpdateAccountPo updateAccountPo) {
ValidateResult validate = updateAccountPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Account account = this.getAccountById(tokenInfo.getCompanyId(), updateAccountPo.getId());
if (account == null) {
return ResultVo.businessError("未知帐号");
}
if (this.isPhoneExists(updateAccountPo.getId(), updateAccountPo.getPhone())) {
return ResultVo.businessError("电话号码已经存在");
}
account.setRealName(updateAccountPo.getRealName());
account.setPhone(updateAccountPo.getPhone());
account.setAddress(updateAccountPo.getAddress());
this.updateById(account);
return ResultVo.success(account);
}
@Override
public ResultVo updatePassword(TokenInfo tokenInfo, UpdatePasswordPo updatePasswordPo) {
ValidateResult validate = updatePasswordPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Account account = null;
if (tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
// 管理员允许修改所有人密码
account = this.getAccountById(updatePasswordPo.getId());
} else {
account = this.getAccountById(updatePasswordPo.getId(), tokenInfo.getCompanyId());
// 非企业主帐号仅能修改自己的密码
if (!tokenInfo.getType().equals(AccountTypeEnum.MAIN.getKey()) && !tokenInfo.getId().equals(updatePasswordPo.getId())) {
return ResultVo.businessError("非企业主帐号仅能修改自己的密码");
}
}
if (account == null) {
return ResultVo.businessError("未知帐号");
}
String password = MD5Encoder.encode(ConcurrentMessageDigest.digestMD5(updatePasswordPo.getPassword().getBytes()));
account.setPassword(password);
this.updateById(account);
return ResultVo.success(account);
}
@Override
public ResultVo updateStatus(TokenInfo tokenInfo, UpdateAccountStatusPo updateStatusPo) {
ValidateResult validate = updateStatusPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Account account = null;
if (tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
// 管理员允许修改所有人密码
account = this.getAccountById(updateStatusPo.getId());
} else {
// 非企业主帐号仅能修改自己的密码
if (!tokenInfo.getType().equals(AccountTypeEnum.MAIN.getKey())) {
return ResultVo.businessError("非企业主帐号不能修改状态");
}
account = this.getAccountById(updateStatusPo.getId(), tokenInfo.getCompanyId());
}
if (account == null) {
return ResultVo.businessError("未知帐号");
}
account.setStatus(updateStatusPo.getStatus());
this.updateById(account);
return ResultVo.success();
}
@Override
public Account getAccountById(Integer accountId, Integer companyId) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getCompanyId, companyId);
queryWrapper.lambda().eq(Account::getId, accountId);
return this.getOne(queryWrapper);
}
@Override
public Account getAccountById(Integer accountId) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getId, accountId);
return this.getOne(queryWrapper);
}
@Override
public boolean isUsernameExists(String username) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getUsername, username);
return this.getOne(queryWrapper) != null;
}
@Override
public boolean isPhoneExists(Integer accountId, String phone) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getPhone, phone);
if (accountId != null)
queryWrapper.lambda().ne(Account::getId, accountId);
return this.getOne(queryWrapper) != null;
}
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.Company;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.CompanyPo;
import com.jair.entity.po.SearchCompanyPo;
import com.jair.entity.po.ValidateResult;
import com.jair.entity.vo.CompanyVo;
import com.jair.entity.vo.DashboardVo;
import com.jair.mapper.CompanyMapper;
import com.jair.service.*;
import com.jair.util.BeanUtil;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* <p>
* 企业主体 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
@Slf4j
public class AnalyticsServiceImpl implements IAnalyticsService {
@Autowired
private IAccountService accountService;
@Autowired
private ICompanyService companyService;
@Autowired
private IDriverService driverService;
@Autowired
private IVehicleService vehicleService;
@Autowired
private IContractService contractService;
@Autowired
private IPlanningService planningService;
@Override
public ResultVo dashboard(TokenInfo tokenInfo) throws ParseException {
DashboardVo dashboardVo = new DashboardVo();
String currentMonthDate = DateUtil.format2Date(new Date(), "yyyy-MM");
String lastMonthDate = DateUtil.format2Date(DateUtil.getAddTime(new Date(), Calendar.MONTH, -1), "yyyy-MM");
String todayDate = DateUtil.format2Date(new Date());
String yesterdayDate = DateUtil.format2Date(DateUtil.getAddDayTime(-1));
Integer currentMonthPlanAmount = planningService.getPlanAmountByPlanDate(tokenInfo, currentMonthDate);
Integer currentMonthActualAmount = planningService.getActualAmountByCreateTime(tokenInfo, currentMonthDate);
Integer todayPlanAmount = planningService.getPlanAmountByPlanDate(tokenInfo, todayDate);
Integer todayActualAmount = planningService.getActualAmountByCreateTime(tokenInfo, todayDate);
// 本月应收
dashboardVo.setCurrentMonthPlanAmount(currentMonthPlanAmount == null ? 0 : currentMonthPlanAmount);
// 本月已收
dashboardVo.setCurrentMonthActualAmount(currentMonthActualAmount == null ? 0 : currentMonthActualAmount);
// 今日应收
dashboardVo.setTodayPlanAmount(todayPlanAmount == null ? 0 : todayPlanAmount);
// 今日已收
dashboardVo.setTodayActualAmount(todayActualAmount == null ? 0 : todayActualAmount);
// 全部司机数量
dashboardVo.setAllDriverCount(driverService.getAllDriverCount(tokenInfo));
// 签约中司机数量
dashboardVo.setSignedDriverCount(contractService.getSignedDriverCount(tokenInfo));
// 全部车辆数量
dashboardVo.setAllVehicleCount(vehicleService.getAllVehicleCount(tokenInfo));
// 签约中车辆数量
dashboardVo.setSignedVehicleCount(contractService.getSignedVehicleCount(tokenInfo));
// 合同相关统计
dashboardVo.setAllContract(contractService.getAllContractCount(tokenInfo));
dashboardVo.setValidContract(contractService.getValidContractCount(tokenInfo));
dashboardVo.setCurrentMonthContract(contractService.getContractCountByCreateTime(tokenInfo, currentMonthDate));
dashboardVo.setLastMonthContract(contractService.getContractCountByCreateTime(tokenInfo, lastMonthDate));
dashboardVo.setTodayContract(contractService.getContractCountByCreateTime(tokenInfo, todayDate));
dashboardVo.setYesterdayContract(contractService.getContractCountByCreateTime(tokenInfo, yesterdayDate));
return ResultVo.success(dashboardVo);
}
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.AttFile;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.mapper.AttFileMapper;
import com.jair.service.IAttFileService;
import com.jair.util.UploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class AttFileServiceImpl extends ServiceImpl<AttFileMapper, AttFile> implements IAttFileService {
@Autowired
private UploadUtil uploadUtil;
@Override
public ResultVo upload(TokenInfo tokenInfo, MultipartFile multipartFile) throws Exception {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
String url = uploadUtil.upload(multipartFile);
if (StringUtils.isEmpty(url)) {
return ResultVo.businessError("上传文件失败");
}
AttFile attFile = new AttFile();
attFile.setOriginName(multipartFile.getOriginalFilename());
attFile.setFilePath(url);
attFile.setFileType(0);
attFile.setCreateTime(new Date());
attFile.setCreateById(tokenInfo.getId());
attFile.setCreateByName(tokenInfo.getRealName());
attFile.setCompanyId(tokenInfo.getCompanyId());
this.save(attFile);
return ResultVo.success(attFile);
}
@Override
public AttFile getAttFileById(Integer companyId, Integer fileId) {
QueryWrapper<AttFile> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(AttFile::getId, fileId);
queryWrapper.lambda().eq(AttFile::getCompanyId, companyId);
return this.getOne(queryWrapper);
}
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.Account;
import com.jair.entity.bo.Company;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.CompanyPo;
import com.jair.entity.po.SearchCompanyPo;
import com.jair.entity.po.ValidateResult;
import com.jair.entity.vo.CompanyVo;
import com.jair.mapper.CompanyMapper;
import com.jair.service.IAccountService;
import com.jair.service.ICompanyService;
import com.jair.util.BeanUtil;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 企业主体 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
@Slf4j
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
@Autowired
private CompanyMapper companyMapper;
@Autowired
private IAccountService accountService;
@Override
public ResultVo createCompany(TokenInfo tokenInfo, CompanyPo companyPo) {
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("帐号权限不足");
}
ValidateResult validate = companyPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
if (isCompanyNameExists(null, companyPo.getName())) {
return ResultVo.businessError("企业名称已经存在");
}
if (isCompanyAbbrExists(null, companyPo.getAbbr())) {
return ResultVo.businessError("企业简称已经存在");
}
Company company = BeanUtil.transform(companyPo, Company.class);
company.setCreateTime(new Date());
company.setCreateById(tokenInfo.getId());
company.setCreateByName(tokenInfo.getRealName());
company.setStatus(1);
companyMapper.insert(company);
return ResultVo.success();
}
@Override
public ResultVo updateExpiredDate(TokenInfo tokenInfo, CompanyPo companyPo) {
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("帐号权限不足");
}
Company company = companyMapper.selectById(companyPo.getId());
if (company == null) {
return ResultVo.businessError("找不到相应企业信息");
}
if (companyPo.getExpiredDate() == null) {
return ResultVo.businessError("有效期不能为空");
}
if (companyPo.getExpiredDate().getTime() < new Date().getTime()) {
return ResultVo.businessError("有效期不能早于当前时间");
}
company.setExpiredDate(companyPo.getExpiredDate());
companyMapper.updateById(company);
return ResultVo.success();
}
@Override
public ResultVo updateStatus(TokenInfo tokenInfo, CompanyPo companyPo) {
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("帐号权限不足");
}
Company company = companyMapper.selectById(companyPo.getId());
if (company == null) {
return ResultVo.businessError("找不到相应企业信息");
}
company.setStatus(companyPo.getStatus());
companyMapper.updateById(company);
return ResultVo.success();
}
@Override
public ResultVo updateCompany(TokenInfo tokenInfo, CompanyPo companyPo) {
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("帐号权限不足");
}
Company company = companyMapper.selectById(companyPo.getId());
if (company == null) {
return ResultVo.businessError("找不到相应企业信息");
}
ValidateResult validate = companyPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
if (isCompanyNameExists(company.getId(), companyPo.getName())) {
return ResultVo.businessError("企业名称已经存在");
}
// if (isCompanyAbbrExists(company.getId(), companyPo.getAbbr())) {
// return ResultVo.businessError("企业简称已经存在");
// }
company.setName(companyPo.getName());
company.setAddress(companyPo.getAddress());
company.setContactName(companyPo.getContactName());
company.setContactPhone(companyPo.getContactPhone());
company.setProvince(companyPo.getProvince());
company.setCity(companyPo.getCity());
company.setDistrict(companyPo.getDistrict());
company.setLevel(companyPo.getLevel());
companyMapper.updateById(company);
return ResultVo.success();
}
@Override
public boolean isCompanyNameExists(Integer id, String companyName) {
QueryWrapper<Company> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Company::getName, companyName);
if (id != null) {
queryWrapper.lambda().ne(Company::getId, id);
}
if (companyMapper.selectOne(queryWrapper) == null) {
return false;
}
return true;
}
@Override
public boolean isCompanyAbbrExists(Integer id, String abbr) {
QueryWrapper<Company> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Company::getAbbr, abbr);
if (id != null) {
queryWrapper.lambda().ne(Company::getId, id);
}
if (companyMapper.selectOne(queryWrapper) == null) {
return false;
}
return true;
}
@Override
public ResultVo listCompanys(TokenInfo tokenInfo, PageInfo<SearchCompanyPo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
if (!tokenInfo.getType().equals(AccountTypeEnum.ADMIN.getKey())) {
return ResultVo.businessError("帐号权限不足");
}
SearchCompanyPo searchPo = pageInfo.getRecords();
QueryWrapper<Company> queryWrapper = new QueryWrapper<>();
if (!StringUtils.isEmpty(searchPo.getName())) {
queryWrapper.lambda().like(Company::getName, searchPo.getName());
}
Page<Company> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<Company> selectPage = companyMapper.selectPage(page, queryWrapper);
List<CompanyVo> companyVos = new ArrayList<>();
if (selectPage.getRecords() != null) {
selectPage.getRecords().forEach(company -> {
CompanyVo companyVo = BeanUtil.transform(company, CompanyVo.class);
// companyVo.setAccounts(accountService.listAccounts(companyVo.getId()));
companyVo.setAccount(accountService.getMainAccount(tokenInfo, company.getId()));
companyVos.add(companyVo);
});
}
PageInfo<List<CompanyVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(companyVos);
return ResultVo.success(resultPageInfo);
}
@Override
public ResultVo myCompany(TokenInfo tokenInfo) {
QueryWrapper<Company> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Company::getId, tokenInfo.getCompanyId());
Company company = this.getOne(queryWrapper);
CompanyVo companyVo = BeanUtil.transform(company, CompanyVo.class);
return ResultVo.success(companyVo);
}
@Override
public void checkExpiredCompanys() {
QueryWrapper<Company> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Company::getStatus, 1);
queryWrapper.lambda().lt(Company::getExpiredDate, DateUtil.format2Date(new Date(), DateUtil.YYYY_MM_DD));
List<Company> companies = this.list(queryWrapper);
if (companies == null || companies.isEmpty()) {
log.error("没有超过有效期的公司");
return;
}
log.error("{}个公司的有效期超过限制", companies.size());
companies.forEach(company -> {
company.setStatus(0);
List<Account> accounts = this.accountService.listAccounts(null, company.getId(), null);
if (accounts != null) {
accounts.forEach(account -> {
account.setStatus(0);
});
this.accountService.updateBatchById(accounts);
}
});
this.updateBatchById(companies);
}
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.ContractOperationLog;
import com.jair.entity.common.TokenInfo;
import com.jair.mapper.ContractOperationLogMapper;
import com.jair.service.IContractOperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class ContractOperationLogServiceImpl extends ServiceImpl<ContractOperationLogMapper, ContractOperationLog> implements IContractOperationLogService {
@Autowired
private ContractOperationLogMapper logMapper;
@Override
public void createLog(TokenInfo tokenInfo, Integer type, Integer contractId, String action, String content) {
ContractOperationLog operationLog = new ContractOperationLog();
operationLog.setType(type);
operationLog.setContractId(contractId);
operationLog.setAction(action);
operationLog.setContent(content);
operationLog.setOperationTime(new Date());
operationLog.setOperatorId(tokenInfo.getId());
operationLog.setOperatorName(tokenInfo.getRealName());
logMapper.insert(operationLog);
}
}
package com.jair.service.impl;
import com.jair.entity.bo.ContractReturnVehicleAttachment;
import com.jair.mapper.ContractReturnVehicleAttachmentMapper;
import com.jair.service.IContractReturnVehicleAttachmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Service
public class ContractReturnVehicleAttachmentServiceImpl extends ServiceImpl<ContractReturnVehicleAttachmentMapper, ContractReturnVehicleAttachment> implements IContractReturnVehicleAttachmentService {
}
package com.jair.service.impl;
import com.jair.entity.bo.ContractReturnVehicle;
import com.jair.mapper.ContractReturnVehicleMapper;
import com.jair.service.IContractReturnVehicleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Service
public class ContractReturnVehicleServiceImpl extends ServiceImpl<ContractReturnVehicleMapper, ContractReturnVehicle> implements IContractReturnVehicleService {
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.*;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.*;
import com.jair.entity.po.*;
import com.jair.entity.vo.ContractVo;
import com.jair.entity.vo.DriverVo;
import com.jair.entity.vo.VehicleVo;
import com.jair.mapper.ContractMapper;
import com.jair.service.*;
import com.jair.util.BeanUtil;
import com.jair.util.DateUtil;
import com.jair.util.ObjectUtil;
import com.jair.util.StringAppend;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import static com.jair.entity.constant.ContractLogActionEnum.CREATE;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
@Slf4j
public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> implements IContractService {
@Autowired
private IVehicleService vehicleService;
@Autowired
private ISourceService sourceService;
@Autowired
private IDriverService driverService;
@Autowired
private IContractOperationLogService logService;
@Autowired
private IAttFileService fileService;
@Autowired
private IContractSignAttachmentService contractAttachmentService;
@Autowired
private IContractReturnVehicleService returnVehicleService;
@Autowired
private IContractReturnVehicleAttachmentService returnVehicleAttachmentService;
@Autowired
private ISequenceService sequenceService;
@Autowired
private IPlanningService planningService;
@Autowired
private ContractMapper contractMapper;
@Override
public ResultVo listContracts(TokenInfo tokenInfo, PageInfo<SearchContractPo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
List<ContractVo> contractVos = new ArrayList<>();
SearchContractPo searchPo = pageInfo.getRecords();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
searchPo.setCompanyId(tokenInfo.getCompanyId());
}
Page<Contract> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<Contract> selectPage = this.contractMapper.queryDriverContracts(page, searchPo);
if (selectPage.getRecords() != null) {
selectPage.getRecords().forEach(contract -> {
Vehicle vehicle = vehicleService.getVehicleById(tokenInfo.getCompanyId(), contract.getVehicleId());
VehicleVo vehicleVo = vehicleService.translateVehicleToVo(tokenInfo, vehicle);
ContractVo contractVo = BeanUtil.transform(contract, ContractVo.class);
contractVo.setVehicleVo(vehicleVo);
if (contractVo.getSourceId() != null && contractVo.getSourceId() > 0) {
Source source = sourceService.getSourceById(tokenInfo.getCompanyId(), contractVo.getSourceId());
contractVo.setSourceVo(source);
}
if (contractVo.getDriverId() != null && contractVo.getDriverId() > 0) {
Driver driver = driverService.getDriverById(tokenInfo.getCompanyId(), contractVo.getDriverId());
DriverVo driverVo = driverService.translateDriverToVo(tokenInfo, driver);
contractVo.setDriverVo(driverVo);
}
contractVo.setFiles(contractAttachmentService.getFilesByContractId(contract.getId()));
// 合同状态(是否有司机合同)
boolean anotherContract = this.checkInEffectContract(contract.getVehicleId(), contract.getType() == 1 ? 2 : 1);
contractVo.setAnotherContract(anotherContract == true ? 1 : 0);
contractVos.add(contractVo);
});
}
PageInfo<List<ContractVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(contractVos);
return ResultVo.success(resultPageInfo);
}
@Override
public ResultVo getContractLogs(TokenInfo tokenInfo, Integer contractId) {
QueryWrapper<ContractOperationLog> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractOperationLog::getContractId, contractId);
queryWrapper.lambda().orderByDesc(ContractOperationLog::getId);
return ResultVo.success(logService.list(queryWrapper));
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo signContract(TokenInfo tokenInfo, SignContractPo signContractPo) throws Exception {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
ValidateResult validate = signContractPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
// 计算合同结束日期
setContractEndDate(signContractPo);
Vehicle vehicle = vehicleService.getVehicleById(tokenInfo.getCompanyId(), signContractPo.getVehicleId());
if (vehicle == null) {
return ResultVo.businessError("未找到相应车辆信息");
}
if (vehicle.getStatus() == 0) {
return ResultVo.businessError("车辆状态不可用");
}
Contract contract = BeanUtil.transform(signContractPo, Contract.class);
if (signContractPo.getType().equals(ContractTypeEnum.SOURCE_CONTRACT.getKey())) {
Source source = sourceService.getSourceById(tokenInfo.getCompanyId(), signContractPo.getSourceId());
if (source == null) {
return ResultVo.businessError("未找到相应车源信息");
}
} else {
Driver driver = driverService.getDriverById(tokenInfo.getCompanyId(), signContractPo.getDriverId());
if (driver == null) {
return ResultVo.businessError("未找到相应司机信息");
}
// 司机合同,校验合同结束日期
Contract sourceContract = this.getContractByType(tokenInfo.getCompanyId(), 1, signContractPo.getVehicleId());
if (sourceContract == null) {
return ResultVo.businessError("未找到相应车源合同信息");
}
if (sourceContract.getStatus() == 0) {
return ResultVo.businessError("车源合同状态不正确");
}
if (signContractPo.getEndDate().getTime() > sourceContract.getEndDate().getTime()) {
return ResultVo.businessError(String.format("司机合同结束日期[%s]不能超过车源合同结束日期[%s]", DateUtil.format2Date(signContractPo.getEndDate()), DateUtil.format2Date(sourceContract.getEndDate())));
}
contract.setSourceId(sourceContract.getSourceId());
}
if (checkInEffectContract(vehicle.getId(), signContractPo.getType())) {
return ResultVo.businessError("该车辆已经存在生效中的合同");
}
contract.setCreateTime(new Date());
contract.setCode(genContractCode(signContractPo.getType()));
contract.setCreateById(tokenInfo.getId());
contract.setCreateByName(tokenInfo.getRealName());
contract.setCompanyId(tokenInfo.getCompanyId());
contract.setStatus(1); //有效
// 设置押金状态
if (contract.getPaidDepositAmount() < contract.getPayableDepositAmount()) {
contract.setDepositStatus(DepositStatusEnum.ARREARAGE.getKey());
} else {
contract.setDepositStatus(DepositStatusEnum.NORMAL.getKey());
}
contract.setReturnDepositAmount(0);
this.save(contract);
// 押金不全设置,押金计划
if (contract.getDepositStatus() == DepositStatusEnum.ARREARAGE.getKey()) {
this.planningService.saveDepositPlanning(tokenInfo, contract);
}
// 生成租金计划
this.planningService.saveRentPlanning(tokenInfo, contract, signContractPo.getFirstPaidAmount());
// 生成费用项计划
this.planningService.saveFeePlanning(tokenInfo, contract, signContractPo.getFees());
// 保存合同附件
contractAttachmentService.updateContractFiles(signContractPo.getFiles(), contract.getId());
makeLog(tokenInfo, CREATE, null, contract);
return ResultVo.success();
}
private void setContractEndDate(SignContractPo signContractPo) {
Date startDate = signContractPo.getStartDate();
Date endDate = null;
if (signContractPo.getLeaseType() == LeaseTypeEnum.DAY_OF_MONTH.getKey()) {
endDate = DateUtil.getAddTime(startDate, Calendar.DATE, signContractPo.getLeasePeriod() * 30);
} else if (signContractPo.getLeaseType() == LeaseTypeEnum.MONTH.getKey()) {
endDate = DateUtil.getAddTime(startDate, Calendar.MONTH, signContractPo.getLeasePeriod());
} else if (signContractPo.getLeaseType() == LeaseTypeEnum.WEEK.getKey()) {
endDate = DateUtil.getAddTime(startDate, Calendar.DATE, signContractPo.getLeasePeriod() * 7);
}
signContractPo.setEndDate(endDate);
}
@Override
public ResultVo updateContract(TokenInfo tokenInfo, UpdateContractPo updateContractPo) {
if (updateContractPo.getContractId() == null || updateContractPo.getContractId() == 0) {
return ResultVo.businessError("未找到相应合同信息");
}
ValidateResult validate = updateContractPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Contract originContract = getContractById(tokenInfo.getCompanyId(), updateContractPo.getContractId());
if (originContract == null) {
return ResultVo.businessError("未找到相应合同信息");
}
// 司机合同,校验合同结束日期
if (originContract.getType().equals(ContractTypeEnum.DRIVER_CONTRACT.getKey())) {
if (updateContractPo.getEndDate().getTime() > originContract.getEndDate().getTime()) {
return ResultVo.businessError(String.format("司机合同结束日期[%s]不能超过车源合同结束日期[%s]", DateUtil.format2Date(updateContractPo.getEndDate()), DateUtil.format2Date(originContract.getEndDate())));
}
}
Contract newContract = BeanUtil.transform(originContract, Contract.class);
newContract.setStartDate(updateContractPo.getStartDate());
newContract.setEndDate(updateContractPo.getEndDate());
newContract.setOdograph(updateContractPo.getOdograph());
newContract.setOdographEv(updateContractPo.getOdographEv());
newContract.setLeaseType(updateContractPo.getLeaseType());
// newContract.setDepositStatus(updateContractPo.getDepositStatus());
newContract.setPayableDepositAmount(updateContractPo.getPayableDepositAmount());
newContract.setPaidDepositAmount(updateContractPo.getPaidDepositAmount());
if (newContract.getPaidDepositAmount() < newContract.getPayableDepositAmount()) {
newContract.setDepositStatus(DepositStatusEnum.ARREARAGE.getKey());
} else {
newContract.setDepositStatus(DepositStatusEnum.NORMAL.getKey());
}
// newContract.setReturnDepositAmount(updateContractPo.getReturnDepositAmount());
newContract.setRentAmount(updateContractPo.getRentAmount());
newContract.setRemark(updateContractPo.getRemark());
this.updateById(newContract);
contractAttachmentService.updateContractFiles(updateContractPo.getFiles(), originContract.getId());
makeLog(tokenInfo, ContractLogActionEnum.UPDATE, originContract, newContract);
return ResultVo.success();
}
@Override
public ResultVo returnDeposit(TokenInfo tokenInfo, ReturnDepositPo returnDepositPo) {
if (returnDepositPo.getContractId() == null || returnDepositPo.getContractId() == 0) {
return ResultVo.businessError("未找到相应合同信息");
}
Contract originContract = getContractById(tokenInfo.getCompanyId(), returnDepositPo.getContractId());
if (originContract == null) {
return ResultVo.businessError("未找到相应合同信息");
}
if (originContract.getStatus() == 1) {
return ResultVo.businessError("合同正在执行中,不能退押金");
}
if (originContract.getDepositStatus() == DepositStatusEnum.ALL_RETURN.getKey()) {
return ResultVo.businessError("押金已经全部返还");
}
// if (returnDepositPo.getReturnType() != 1 && returnDepositPo.getReturnType() != 2) {
// return ResultVo.businessError("返还类型不正确");
// }
if (returnDepositPo.getReturnAmount() == null || returnDepositPo.getReturnAmount() <= 0) {
return ResultVo.businessError("返还金额不正确");
}
// if (returnDepositPo.getReturnType() == 1 && originContract.getRentAmount() != returnDepositPo.getReturnAmount()) {
// return ResultVo.businessError("返还类型和返还金额不匹配");
// }
Contract newContract = BeanUtil.transform(originContract, Contract.class);
Integer returnAcount = newContract.getReturnDepositAmount() + returnDepositPo.getReturnAmount();
newContract.setReturnDepositAmount(returnAcount);
if (returnAcount >= newContract.getPaidDepositAmount()) {
newContract.setDepositStatus(DepositStatusEnum.ALL_RETURN.getKey()); // 全部已退
} else {
newContract.setDepositStatus(DepositStatusEnum.PORTION_RETURN.getKey()); // 部分退还
}
this.updateById(newContract);
makeLog(tokenInfo, ContractLogActionEnum.RETURN_DEPOSIT, originContract, newContract, returnDepositPo.getRemark());
return ResultVo.success();
}
@Override
public ResultVo terminateContract(TokenInfo tokenInfo, TerminateContractPo terminatePo) {
if (terminatePo.getContractId() == null || terminatePo.getContractId() == 0) {
return ResultVo.businessError("未找到相应合同信息");
}
Contract contract = getContractById(tokenInfo.getCompanyId(), terminatePo.getContractId());
if (contract == null) {
return ResultVo.businessError("未找到相应合同信息");
}
// 中止车源合同,先校验是否存在生效中的司机合同
if (contract.getType().equals(ContractTypeEnum.SOURCE_CONTRACT.getKey())) {
if (checkInEffectContract(contract.getVehicleId(), ContractTypeEnum.DRIVER_CONTRACT.getKey())) {
return ResultVo.businessError("司机合同正在执行中,不能中止车源合同");
}
}
contract.setStatus(0);
contract.setDepositStatus(0);
this.updateById(contract);
if (terminatePo.getDeletePlanning() == 1) { // 删除所有收费计划
this.planningService.disablePlanningByContractId(contract.getId());
}
makeLog(tokenInfo, ContractLogActionEnum.TERMINATE, null, contract);
return ResultVo.success();
}
@Override
public ResultVo returnVehicle(TokenInfo tokenInfo, ReturnVehiclePo returnVehiclePo) {
if (returnVehiclePo.getContractId() == null || returnVehiclePo.getContractId() == 0) {
return ResultVo.businessError("未找到相应合同信息");
}
Contract contract = getContractById(tokenInfo.getCompanyId(), returnVehiclePo.getContractId());
if (contract == null) {
return ResultVo.businessError("未找到相应合同信息");
}
if (!contract.getType().equals(ContractTypeEnum.DRIVER_CONTRACT.getKey())) {
return ResultVo.businessError("合同类型错误");
}
if (contract.getStatus() == 1) {
return ResultVo.businessError("合同正在执行中,不能上传交车信息");
}
ContractReturnVehicle contractReturnVehicle = BeanUtil.transform(returnVehiclePo, ContractReturnVehicle.class);
contractReturnVehicle.setCreateTime(new Date());
contractReturnVehicle.setCreateById(tokenInfo.getId());
contractReturnVehicle.setCreateByName(tokenInfo.getRealName());
contractReturnVehicle.setCompanyId(tokenInfo.getCompanyId());
this.returnVehicleService.save(contractReturnVehicle);
if (returnVehiclePo.getAccidentFiles() != null) {
for (Integer fileId : returnVehiclePo.getAccidentFiles()) {
ContractReturnVehicleAttachment contractSignAttachment = new ContractReturnVehicleAttachment();
contractSignAttachment.setReturnId(contractReturnVehicle.getId());
contractSignAttachment.setFileId(fileId);
this.returnVehicleAttachmentService.save(contractSignAttachment);
}
}
makeLog(tokenInfo, ContractLogActionEnum.RETURN_VEHICLE, null, contract);
return ResultVo.success();
}
@Override
public ResultVo getContractById(TokenInfo tokenInfo, Integer contractId) {
Contract contract = this.getContractById(tokenInfo.getCompanyId(), contractId);
ContractVo contractVo = BeanUtil.transform(contract, ContractVo.class);
Vehicle vehicle = vehicleService.getVehicleById(tokenInfo.getCompanyId(), contract.getVehicleId());
VehicleVo vehicleVo = vehicleService.translateVehicleToVo(tokenInfo, vehicle);
contractVo.setVehicleVo(vehicleVo);
if (contractVo.getSourceId() != null && contractVo.getSourceId() > 0) {
Source source = sourceService.getSourceById(tokenInfo.getCompanyId(), contractVo.getSourceId());
contractVo.setSourceVo(source);
}
if (contractVo.getDriverId() != null && contractVo.getDriverId() > 0) {
Driver driver = driverService.getDriverById(tokenInfo.getCompanyId(), contractVo.getDriverId());
DriverVo driverVo = driverService.translateDriverToVo(tokenInfo, driver);
contractVo.setDriverVo(driverVo);
}
contractVo.setFiles(contractAttachmentService.getFilesByContractId(contract.getId()));
return ResultVo.success(contractVo);
}
@Override
public Contract getContractById(Integer companyId, Integer contractId) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Contract::getCompanyId, companyId);
queryWrapper.lambda().eq(Contract::getId, contractId);
return this.getOne(queryWrapper);
}
@Override
public Contract getContractByType(Integer companyId, Integer type, Integer id) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Contract::getCompanyId, companyId);
queryWrapper.lambda().eq(Contract::getType, type);
queryWrapper.lambda().eq(Contract::getStatus, 1);
if (type.equals(ContractTypeEnum.SOURCE_CONTRACT.getKey())) {
queryWrapper.lambda().eq(Contract::getVehicleId, id);
} else {
queryWrapper.lambda().eq(Contract::getDriverId, id);
}
return this.getOne(queryWrapper);
}
@Override
@Synchronized
public String genContractCode(Integer type) {
String pre = "EC";
StringBuffer code = new StringBuffer();
if (ContractTypeEnum.SOURCE_CONTRACT.getKey().equals(type)) {
pre = "SC";
} else if (ContractTypeEnum.DRIVER_CONTRACT.getKey().equals(type)) {
pre = "DC";
}
code.append(pre);
code.append(DateUtil.format2Date(new Date(), DateUtil.YYMMDD));
code.append(String.format("%04d", sequenceService.getSequence() % 1000));
code.append(getRandomNumber());
return code.toString();
}
private String getRandomNumber() {
int i = (int) (Math.random() * 1000);
return String.format("%04d", i);
}
@Override
public boolean checkInEffectContract(Integer vehicleId, Integer type) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Contract::getVehicleId, vehicleId);
if (type != null)
queryWrapper.lambda().eq(Contract::getType, type);
queryWrapper.lambda().eq(Contract::getStatus, 1);
if (this.getOne(queryWrapper) == null) {
return false;
}
return true;
}
private void makeLog(TokenInfo tokenInfo, ContractLogActionEnum action, Contract originContract, Contract newContract, String... extendsContent) {
StringAppend content = new StringAppend(",");
switch (action) {
case CREATE: {
content.append("创建合同");
break;
}
case UPDATE: {
if (!ObjectUtil.equals(originContract.getOdograph(), newContract.getOdograph())) {
content.append(String.format("里程从[%s]修改为[%s]", originContract.getOdograph(), newContract.getOdograph()));
}
if (!ObjectUtil.equals(originContract.getOdographEv(), newContract.getOdographEv())) {
content.append(String.format("EV里程从[%s]修改为[%s]", originContract.getOdographEv(), newContract.getOdographEv()));
}
if (!ObjectUtil.equals(originContract.getStartDate().getTime(), newContract.getStartDate().getTime())) {
content.append(String.format("开始日期从[%s]修改为[%s]", DateUtil.format2Date(originContract.getStartDate()), DateUtil.format2Date(newContract.getStartDate())));
}
if (!ObjectUtil.equals(originContract.getEndDate().getTime(), newContract.getEndDate().getTime())) {
content.append(String.format("结束日期从[%s]修改为[%s]", DateUtil.format2Date(originContract.getEndDate()), DateUtil.format2Date(newContract.getEndDate())));
}
if (!ObjectUtil.equals(originContract.getLeaseType(), newContract.getLeaseType())) {
content.append(String.format("租赁方式从[%s]修改为[%s]", LeaseTypeEnum.codeToName(originContract.getLeaseType()), LeaseTypeEnum.codeToName(newContract.getLeaseType())));
}
if (!ObjectUtil.equals(originContract.getDepositStatus(), newContract.getDepositStatus())) {
content.append(String.format("押金状态从[%s]修改为[%s]", DepositStatusEnum.codeToName(originContract.getDepositStatus()), DepositStatusEnum.codeToName(newContract.getDepositStatus())));
}
if (!ObjectUtil.equals(originContract.getPayableDepositAmount(), newContract.getPayableDepositAmount())) {
content.append(String.format("应付押金从[%s]修改为[%s]", originContract.getPayableDepositAmount(), newContract.getPayableDepositAmount()));
}
if (!ObjectUtil.equals(originContract.getPaidDepositAmount(), newContract.getPaidDepositAmount())) {
content.append(String.format("已付押金从[%s]修改为[%s]", originContract.getPaidDepositAmount(), newContract.getPaidDepositAmount()));
}
if (!ObjectUtil.equals(originContract.getReturnDepositAmount(), newContract.getReturnDepositAmount())) {
content.append(String.format("返还押金从[%s]修改为[%s]", originContract.getReturnDepositAmount(), newContract.getReturnDepositAmount()));
}
if (!ObjectUtil.equals(originContract.getRentAmount(), newContract.getRentAmount())) {
content.append(String.format("租金从[%s]修改为[%s]", originContract.getRentAmount(), newContract.getRentAmount()));
}
if (!ObjectUtil.equals(originContract.getRemark(), newContract.getRemark())) {
content.append(String.format("备注从[%s]修改为[%s]", originContract.getRemark(), newContract.getRemark()));
}
break;
}
case RENEW: {
if (originContract.getStartDate().getTime() != newContract.getStartDate().getTime()) {
content.append(String.format("开始日期从[%s]修改为[%s]", DateUtil.format2Date(originContract.getStartDate()), DateUtil.format2Date(newContract.getEndDate())));
}
if (originContract.getEndDate().getTime() != newContract.getEndDate().getTime()) {
content.append(String.format("结束日期从[%s]修改为[%s]", DateUtil.format2Date(originContract.getEndDate()), DateUtil.format2Date(newContract.getEndDate())));
}
break;
}
case TERMINATE: {
content.append("中止合同");
break;
}
case RETURN_VEHICLE: {
content.append("上传了交车信息");
break;
}
case RETURN_DEPOSIT: {
content.append(String.format("返还押金[%s]", newContract.getReturnDepositAmount() - originContract.getReturnDepositAmount()));
if (newContract.getDepositStatus() == DepositStatusEnum.ALL_RETURN.getKey()) {
content.append("押金已全部返还");
}
break;
}
}
if (extendsContent != null && extendsContent.length > 0) {
StringAppend extendsString = new StringAppend(",");
for (String s : extendsContent) {
if (StringUtils.isEmpty(s)) {
continue;
}
extendsString.append(s);
}
if (!extendsString.isEmpty()) {
content.append(extendsString);
}
}
if (StringUtils.isEmpty(content.toString())) {
return;
}
logService.createLog(tokenInfo, 1, newContract.getId(), action.getName(), content.toString());
}
@Override
public void checkEndedContracts() {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().lt(Contract::getEndDate, new Date());
queryWrapper.lambda().eq(Contract::getStatus, 1);
queryWrapper.lambda().eq(Contract::getType, 2);
List<Contract> contracts = this.list(queryWrapper);
if (contracts == null || contracts.isEmpty()) {
log.error("没有超过有效期的合同");
return;
}
log.error("{}个合同的有效期超过限制", contracts.size());
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(0);
tokenInfo.setRealName("系统");
contracts.forEach(contract -> {
TerminateContractPo terminatePo = new TerminateContractPo();
terminatePo.setContractId(contract.getId());
terminatePo.setDeletePlanning(0);
this.terminateContract(tokenInfo, terminatePo);
});
}
@Override
public Integer getContractCountByCreateTime(TokenInfo tokenInfo, String createTime) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Contract::getCompanyId, tokenInfo.getCompanyId());
}
queryWrapper.lambda().likeRight(Contract::getCreateTime, createTime);
queryWrapper.lambda().eq(Contract::getType, ContractTypeEnum.DRIVER_CONTRACT.getKey());
return this.count(queryWrapper);
}
@Override
public Integer getAllContractCount(TokenInfo tokenInfo) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Contract::getCompanyId, tokenInfo.getCompanyId());
}
queryWrapper.lambda().eq(Contract::getType, ContractTypeEnum.DRIVER_CONTRACT.getKey());
return this.count(queryWrapper);
}
@Override
public Integer getValidContractCount(TokenInfo tokenInfo) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Contract::getCompanyId, tokenInfo.getCompanyId());
}
queryWrapper.lambda().eq(Contract::getStatus, 1);
queryWrapper.lambda().eq(Contract::getType, ContractTypeEnum.DRIVER_CONTRACT.getKey());
return this.count(queryWrapper);
}
@Override
public Integer getSignedDriverCount(TokenInfo tokenInfo) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Contract::getCompanyId, tokenInfo.getCompanyId());
}
queryWrapper.lambda().eq(Contract::getStatus, 1);
queryWrapper.lambda().eq(Contract::getType, ContractTypeEnum.DRIVER_CONTRACT.getKey());
queryWrapper.select("DISTINCT driver_id");
return this.count(queryWrapper);
}
@Override
public Integer getSignedVehicleCount(TokenInfo tokenInfo) {
QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Contract::getCompanyId, tokenInfo.getCompanyId());
}
queryWrapper.lambda().eq(Contract::getStatus, 1);
queryWrapper.lambda().eq(Contract::getType, ContractTypeEnum.DRIVER_CONTRACT.getKey());
queryWrapper.select("DISTINCT vehicle_id");
return this.count(queryWrapper);
}
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.ContractSignAttachment;
import com.jair.mapper.ContractSignAttachmentMapper;
import com.jair.service.IAttFileService;
import com.jair.service.IContractSignAttachmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class ContractSignAttachmentServiceImpl extends ServiceImpl<ContractSignAttachmentMapper, ContractSignAttachment> implements IContractSignAttachmentService {
@Autowired
private IAttFileService fileService;
@Override
public List<AttFile> getFilesByContractId(Integer contractId) {
QueryWrapper<ContractSignAttachment> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractSignAttachment::getContractId, contractId);
List<ContractSignAttachment> list = list(queryWrapper);
if (list == null || list.isEmpty()) {
return null;
}
List<Integer> ids = list.stream().map(ContractSignAttachment::getFileId).collect(Collectors.toList());
QueryWrapper<AttFile> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.lambda().in(AttFile::getId, ids);
return fileService.list(queryWrapper1);
}
@Override
public void deleteFilesByContractId(Integer contractId) {
QueryWrapper<ContractSignAttachment> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractSignAttachment::getContractId, contractId);
this.remove(queryWrapper);
}
@Override
@Transactional
public void updateContractFiles(List<Integer> files, Integer contractId) {
this.deleteFilesByContractId(contractId);
if (files == null || files.isEmpty()) {
return;
}
for (Integer fileId : files) {
ContractSignAttachment contractSignAttachment = new ContractSignAttachment();
contractSignAttachment.setContractId(contractId);
contractSignAttachment.setFileId(fileId);
this.save(contractSignAttachment);
}
}
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.CfgData;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.DataTypeEnum;
import com.jair.entity.po.SearchDataPo;
import com.jair.entity.po.SysDataPo;
import com.jair.entity.vo.ModelVo;
import com.jair.mapper.CfgDataMapper;
import com.jair.service.IDataService;
import com.jair.util.BeanUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class DataServiceImpl extends ServiceImpl<CfgDataMapper, CfgData> implements IDataService {
@Override
public ResultVo listEnvironmentalStandards(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(0, DataTypeEnum.ENVIRONMENTAL_STANDARDS.getKey(), null));
}
@Override
public ResultVo listUseCharacters(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(0, DataTypeEnum.CHARACTER.getKey(), null));
}
@Override
public ResultVo listColors(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(0, DataTypeEnum.COLOR.getKey(), null));
}
@Override
public ResultVo listEngineTypes(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(0, DataTypeEnum.ENGINE_TYPE.getKey(), null));
}
@Override
public ResultVo listVehicleTypes(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(0, DataTypeEnum.VEHICLE_TYPE.getKey(), null));
}
@Override
public ResultVo listBrands(TokenInfo tokenInfo) {
return ResultVo.success(listDatas(tokenInfo.getCompanyId(), DataTypeEnum.BRAND.getKey(), null));
}
public Integer getBrandIdByName(TokenInfo tokenInfo, String name) {
QueryWrapper<CfgData> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgData::getCompanyId, tokenInfo.getCompanyId());
queryWrapper.lambda().eq(CfgData::getType, DataTypeEnum.BRAND.getKey());
queryWrapper.lambda().eq(CfgData::getName, name);
if (this.getOne(queryWrapper) != null) {
return this.getOne(queryWrapper).getId();
}
return 0;
}
@Override
public ResultVo listModels(TokenInfo tokenInfo, SearchDataPo searchPo) {
List<CfgData> datas = listDatas(tokenInfo.getCompanyId(), DataTypeEnum.MODEL.getKey(), searchPo.getParentId());
if (datas == null || datas.isEmpty()) {
return ResultVo.success();
}
List<ModelVo> models = new ArrayList<>();
datas.forEach(data -> {
CfgData brandData = getDataById(tokenInfo.getCompanyId(), data.getParentId());
ModelVo modelVo = BeanUtil.transform(data, ModelVo.class);
if (brandData != null) {
modelVo.setBrandId(brandData.getId());
modelVo.setBrandCode(brandData.getCode());
modelVo.setBrandName(brandData.getName());
}
models.add(modelVo);
});
return ResultVo.success(models);
}
@Override
public ResultVo createData(TokenInfo tokenInfo, SysDataPo dataPo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
if (isDataNameExists(tokenInfo.getCompanyId(), dataPo.getType(), dataPo.getParentId(), dataPo.getName())) {
return ResultVo.businessError("该数据已存在");
}
CfgData data = BeanUtil.transform(dataPo, CfgData.class);
data.setCompanyId(tokenInfo.getCompanyId());
this.save(data);
return ResultVo.success();
}
@Override
public List<CfgData> listDatas(Integer companyId, Integer type, Integer parentId) {
QueryWrapper<CfgData> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgData::getCompanyId, companyId);
queryWrapper.lambda().eq(CfgData::getType, type);
if (parentId != null) {
queryWrapper.lambda().eq(CfgData::getParentId, parentId);
}
return this.list(queryWrapper);
}
@Override
public CfgData getDataById(Integer companyId, Integer dataId) {
QueryWrapper<CfgData> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgData::getCompanyId, companyId);
queryWrapper.lambda().eq(CfgData::getId, dataId);
return this.getOne(queryWrapper);
}
@Override
public Boolean isDataNameExists(Integer companyId, Integer type, Integer parentId, String name) {
QueryWrapper<CfgData> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgData::getCompanyId, companyId);
queryWrapper.lambda().eq(CfgData::getName, name);
if (parentId != null)
queryWrapper.lambda().eq(CfgData::getParentId, parentId);
if (type != null)
queryWrapper.lambda().eq(CfgData::getType, type);
return this.getOne(queryWrapper) != null;
}
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.Driver;
import com.jair.entity.bo.DrivingLicense;
import com.jair.entity.bo.IdentityCard;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.DriverPo;
import com.jair.entity.po.SearchDriverPo;
import com.jair.entity.po.ValidateResult;
import com.jair.entity.vo.ContractVo;
import com.jair.entity.vo.DriverVo;
import com.jair.entity.vo.VehicleVo;
import com.jair.mapper.DriverMapper;
import com.jair.service.IAttFileService;
import com.jair.service.IDriverService;
import com.jair.service.IDrivingLicenseService;
import com.jair.service.IIdentityCardService;
import com.jair.util.BeanUtil;
import com.jair.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService {
@Autowired
private IIdentityCardService identityCardService;
@Autowired
private IDrivingLicenseService licenseService;
@Autowired
private IAttFileService fileService;
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo createDriver(TokenInfo tokenInfo, DriverPo driverPo) throws Exception {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
ValidateResult validate = driverPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
if (isDriverExists(tokenInfo.getCompanyId(), null, driverPo.getIdentityNumber())) {
return ResultVo.businessError("身份证号码已经存在");
}
Date createTime = new Date();
// String identityNumber = driverPo.getIdentityNumber();
// String brithday = null;
// if (identityNumber.trim().length() == 15) {
// brithday = identityNumber.substring(6, 12);
// Integer yy = Integer.parseInt(brithday.substring(0, 2));
// brithday = yy < 40 ? "20" : "19" + brithday;
// } else {
// brithday = identityNumber.substring(6, 14);
// }
IdentityCard identity = new IdentityCard();
identity.setBirthday(driverPo.getBirthday());
identity.setNation(driverPo.getNation());
identity.setOriginAddress(driverPo.getOriginAddress());
identity.setIssueOrganization(driverPo.getIssueOrganization());
identity.setValidPeriodStart(driverPo.getIdentityValidPeriodStart());
identity.setValidPeriodEnd(driverPo.getIdentityValidPeriodEnd());
identity.setFrontFileId(driverPo.getFrontFileId());
identity.setBackFileId(driverPo.getBackFileId());
identity.setCreateTime(createTime);
identity.setCreateById(tokenInfo.getId());
identity.setCreateByName(tokenInfo.getRealName());
identity.setCompanyId(tokenInfo.getCompanyId());
identityCardService.save(identity);
if (identity.getId() == null || identity.getId() == 0) {
throw new Exception("身份证信息保存失败");
}
DrivingLicense license = new DrivingLicense();
license.setCredentialNo(driverPo.getCredentialNo());
license.setFileNo(driverPo.getFileNo());
license.setFirstIssue(driverPo.getFirstIssue());
license.setDrivingClass(driverPo.getDrivingClass());
license.setValidPeriodStart(driverPo.getLicenseValidPeriodStart());
license.setValidPeriodEnd(driverPo.getLicenseValidPeriodEnd());
license.setMainFileId(driverPo.getMainFileId());
license.setSecondFileId(driverPo.getSecondFileId());
license.setCreateTime(createTime);
license.setCreateById(tokenInfo.getId());
license.setCreateByName(tokenInfo.getRealName());
license.setCompanyId(tokenInfo.getCompanyId());
licenseService.save(license);
if (license.getId() == null || license.getId() == 0) {
throw new Exception("驾驶证信息保存失败");
}
Driver driver = BeanUtil.transform(driverPo, Driver.class);
driver.setIdentityId(identity.getId());
driver.setLicenseId(license.getId());
driver.setCreateTime(createTime);
driver.setCreateById(tokenInfo.getId());
driver.setCreateByName(tokenInfo.getRealName());
driver.setCompanyId(tokenInfo.getCompanyId());
this.save(driver);
if (driver.getId() == null || driver.getId() == 0) {
throw new Exception("司机信息保存失败");
}
return ResultVo.success(driver);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo updateDriver(TokenInfo tokenInfo, DriverPo driverPo) throws Exception {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
ValidateResult validate = driverPo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Driver driver = getDriverById(tokenInfo.getCompanyId(), driverPo.getId());
if (driver == null) {
return ResultVo.businessError("未找到该司机");
}
// String identityNumber = driverPo.getIdentityNumber();
// String brithday = null;
// if (identityNumber.trim().length() == 15) {
// brithday = identityNumber.substring(6, 12);
// Integer yy = Integer.parseInt(brithday.substring(0, 2));
// brithday = yy < 40 ? "20" : "19" + brithday;
// } else {
// brithday = identityNumber.substring(6, 14);
// }
IdentityCard identity = identityCardService.getById(driver.getIdentityId());
identity.setBirthday(driverPo.getBirthday());
identity.setNation(driverPo.getNation());
identity.setOriginAddress(driverPo.getOriginAddress());
identity.setIssueOrganization(driverPo.getIssueOrganization());
identity.setValidPeriodStart(driverPo.getIdentityValidPeriodStart());
identity.setValidPeriodEnd(driverPo.getIdentityValidPeriodEnd());
identity.setFrontFileId(driverPo.getFrontFileId());
identity.setBackFileId(driverPo.getBackFileId());
identityCardService.updateById(identity);
DrivingLicense license = licenseService.getById(driver.getLicenseId());
license.setCredentialNo(driverPo.getCredentialNo());
license.setFileNo(driverPo.getFileNo());
license.setFirstIssue(driverPo.getFirstIssue());
license.setDrivingClass(driverPo.getDrivingClass());
license.setValidPeriodStart(driverPo.getLicenseValidPeriodStart());
license.setValidPeriodEnd(driverPo.getLicenseValidPeriodEnd());
license.setMainFileId(driverPo.getMainFileId());
license.setSecondFileId(driverPo.getSecondFileId());
licenseService.updateById(license);
BeanUtil.copyProperties(driverPo, driver);
this.updateById(driver);
return ResultVo.success();
}
@Override
public ResultVo listDrivers(TokenInfo tokenInfo, PageInfo<SearchDriverPo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
SearchDriverPo searchPo = pageInfo.getRecords();
QueryWrapper<Driver> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Driver::getCompanyId, tokenInfo.getCompanyId());
}
if (!StringUtils.isEmpty(searchPo.getIdentityNumber())) {
queryWrapper.lambda().like(Driver::getIdentityNumber, searchPo.getIdentityNumber());
}
if (!StringUtils.isEmpty(searchPo.getName())) {
queryWrapper.lambda().like(Driver::getName, searchPo.getName());
}
if (!StringUtils.isEmpty(searchPo.getPhone())) {
queryWrapper.lambda().like(Driver::getPhone, searchPo.getPhone());
}
if (!StringUtils.isEmpty(searchPo.getAddress())) {
queryWrapper.lambda().like(Driver::getAddress, searchPo.getAddress());
}
if (!StringUtils.isEmpty(searchPo.getContactName())) {
queryWrapper.lambda().like(Driver::getContactName, searchPo.getContactName());
}
if (!StringUtils.isEmpty(searchPo.getContactPhone())) {
queryWrapper.lambda().like(Driver::getContactPhone, searchPo.getContactPhone());
}
List<DriverVo> driverVos = new ArrayList<>();
Page<Driver> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<Driver> selectPage = this.page(page, queryWrapper);
if (selectPage.getRecords() != null) {
selectPage.getRecords().forEach(driver -> {
// TODO 获取 合同状态
DriverVo driverVo = BeanUtil.transform(driver, DriverVo.class);
driverVo = this.fillIdentityCardInfo(tokenInfo, driverVo, driver.getIdentityId());
driverVo = this.fillDrivingLicenseInfo(tokenInfo, driverVo, driver.getLicenseId());
driverVos.add(driverVo);
});
}
PageInfo<List<DriverVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(driverVos);
return ResultVo.success(resultPageInfo);
}
@Override
public ResultVo listAllDrivers(TokenInfo tokenInfo) {
QueryWrapper<Driver> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().select(Driver::getId, Driver::getName, Driver::getPhone);
queryWrapper.lambda().eq(Driver::getCompanyId, tokenInfo.getCompanyId());
List<Driver> drivers = this.list(queryWrapper);
if (drivers == null || drivers.isEmpty()) {
return ResultVo.success();
}
List<DriverVo> driverVos = new ArrayList<>();
drivers.forEach(driver -> {
DriverVo driverVo = BeanUtil.transform(driver, DriverVo.class);
driverVos.add(driverVo);
});
return ResultVo.success(driverVos);
}
@Override
public boolean isDriverExists(Integer companyId, Integer driverId, String identityNumber) {
QueryWrapper<Driver> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Driver::getCompanyId, companyId);
queryWrapper.lambda().eq(Driver::getIdentityNumber, identityNumber);
if (driverId != null) {
queryWrapper.lambda().ne(Driver::getId, driverId);
}
if (this.getOne(queryWrapper) == null) {
return false;
}
return true;
}
@Override
public ResultVo getDriverById(TokenInfo tokenInfo, Integer driverId) {
Driver driver = this.getDriverById(tokenInfo.getCompanyId(), driverId);
DriverVo driverVo = this.translateDriverToVo(tokenInfo, driver);
return ResultVo.success(driverVo);
}
@Override
public Driver getDriverById(Integer companyId, Integer driverId) {
QueryWrapper<Driver> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Driver::getCompanyId, companyId);
queryWrapper.lambda().eq(Driver::getId, driverId);
return this.getOne(queryWrapper);
}
@Override
public DriverVo fillIdentityCardInfo(TokenInfo tokenInfo, DriverVo driverVo, Integer identityId) {
IdentityCard identityCard = identityCardService.getById(identityId);
if (identityCard != null) {
driverVo.setNation(identityCard.getNation());
driverVo.setBirthday(identityCard.getBirthday());
driverVo.setOriginAddress(identityCard.getOriginAddress());
driverVo.setIssueOrganization(identityCard.getIssueOrganization());
driverVo.setIdentityValidPeriodStart(identityCard.getValidPeriodStart());
driverVo.setIdentityValidPeriodEnd(identityCard.getValidPeriodEnd());
if (identityCard.getFrontFileId() != null) {
driverVo.setFrontFile(fileService.getAttFileById(tokenInfo.getCompanyId(), identityCard.getFrontFileId()));
}
if (identityCard.getBackFileId() != null) {
driverVo.setBackFile(fileService.getAttFileById(tokenInfo.getCompanyId(), identityCard.getBackFileId()));
}
}
return driverVo;
}
@Override
public DriverVo fillDrivingLicenseInfo(TokenInfo tokenInfo, DriverVo driverVo, Integer licenseId) {
DrivingLicense license = licenseService.getById(licenseId);
if (license != null) {
driverVo.setCredentialNo(license.getCredentialNo());
driverVo.setFileNo(license.getFileNo());
driverVo.setFirstIssue(license.getFirstIssue());
driverVo.setDrivingClass(license.getDrivingClass());
driverVo.setLicenseValidPeriodStart(license.getValidPeriodStart());
driverVo.setLicenseValidPeriodEnd(license.getValidPeriodEnd());
if (license.getMainFileId() != null) {
driverVo.setMainFile(fileService.getAttFileById(tokenInfo.getCompanyId(), license.getMainFileId()));
}
if (license.getSecondFileId() != null) {
driverVo.setSecondFile(fileService.getAttFileById(tokenInfo.getCompanyId(), license.getSecondFileId()));
}
}
return driverVo;
}
@Override
public DriverVo translateDriverToVo(TokenInfo tokenInfo, Driver driver) {
DriverVo driverVo = BeanUtil.transform(driver, DriverVo.class);
driverVo = this.fillIdentityCardInfo(tokenInfo, driverVo, driver.getIdentityId());
driverVo = this.fillDrivingLicenseInfo(tokenInfo, driverVo, driver.getLicenseId());
return driverVo;
}
@Override
public Integer getAllDriverCount(TokenInfo tokenInfo) {
QueryWrapper<Driver> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Driver::getCompanyId, tokenInfo.getCompanyId());
}
return this.count(queryWrapper);
}
}
package com.jair.service.impl;
import com.jair.entity.bo.DrivingLicense;
import com.jair.mapper.DrivingLicenseMapper;
import com.jair.service.IDrivingLicenseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 驾驶证 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class DrivingLicenseServiceImpl extends ServiceImpl<DrivingLicenseMapper, DrivingLicense> implements IDrivingLicenseService {
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.CfgData;
import com.jair.entity.bo.CfgFee;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.mapper.CfgDataMapper;
import com.jair.mapper.CfgFeeMapper;
import com.jair.service.IFeeService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class FeeServiceImpl extends ServiceImpl<CfgFeeMapper, CfgFee> implements IFeeService {
@Override
public ResultVo list(TokenInfo tokenInfo, Integer status) {
QueryWrapper<CfgFee> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgFee::getCompanyId, tokenInfo.getCompanyId());
if (status == 0 || status == 1) {
queryWrapper.lambda().eq(CfgFee::getStatus, status);
}
return ResultVo.success(this.list(queryWrapper));
}
@Override
public ResultVo create(TokenInfo tokenInfo, CfgFee fee) {
if (fee == null) {
return ResultVo.businessError("数据异常");
}
if (StringUtils.isEmpty(fee.getName())) {
return ResultVo.businessError("费用名称不能为空");
}
if (fee.getAmount() <= 0) {
return ResultVo.businessError("费用金额不能为0");
}
if (fee.getTiming() > 5 || fee.getTiming() < 1) {
return ResultVo.businessError("费用时机不正确");
}
fee.setCompanyId(tokenInfo.getCompanyId());
fee.setStatus(1);
this.save(fee);
return ResultVo.success();
}
@Override
public ResultVo disable(TokenInfo tokenInfo, Integer feeId) {
CfgFee fee = this.getFeeById(tokenInfo.getCompanyId(), feeId);
fee.setStatus(0);
this.updateById(fee);
return ResultVo.success();
}
@Override
public ResultVo enable(TokenInfo tokenInfo, Integer feeId) {
CfgFee fee = this.getFeeById(tokenInfo.getCompanyId(), feeId);
fee.setStatus(1);
this.updateById(fee);
return ResultVo.success();
}
@Override
public CfgFee getFeeById(Integer companyId, Integer feeId) {
QueryWrapper<CfgFee> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CfgFee::getCompanyId, companyId);
queryWrapper.lambda().eq(CfgFee::getId, feeId);
return this.getOne(queryWrapper);
}
}
package com.jair.service.impl;
import com.jair.entity.bo.IdentityCard;
import com.jair.mapper.IdentityCardMapper;
import com.jair.service.IIdentityCardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class IdentityCardServiceImpl extends ServiceImpl<IdentityCardMapper, IdentityCard> implements IIdentityCardService {
}
package com.jair.service.impl;
import com.jair.entity.bo.Menu;
import com.jair.mapper.MenuMapper;
import com.jair.service.IMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-31
*/
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IMenuService {
}
package com.jair.service.impl;
import com.jair.entity.bo.Motorcade;
import com.jair.mapper.MotorcadeMapper;
import com.jair.service.IMotorcadeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 车队表 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class MotorcadeServiceImpl extends ServiceImpl<MotorcadeMapper, Motorcade> implements IMotorcadeService {
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.*;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.*;
import com.jair.entity.po.*;
import com.jair.entity.vo.FeePlanningVo;
import com.jair.entity.vo.PlanningOperationLogVo;
import com.jair.mapper.ContractMapper;
import com.jair.mapper.FeePlanningMapper;
import com.jair.mapper.PlanningOperationLogMapper;
import com.jair.service.IContractService;
import com.jair.service.IPlanningService;
import com.jair.util.DateUtil;
import com.jair.util.StringAppend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class PlanningServiceImpl extends ServiceImpl<FeePlanningMapper, FeePlanning> implements IPlanningService {
@Autowired
private FeePlanningMapper planningMapper;
@Autowired
private PlanningOperationLogMapper operationLogMapper;
@Autowired
@Lazy
private IContractService contractService;
@Override
public ResultVo listPlanning(TokenInfo tokenInfo, PageInfo<SearchPlanningPo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
SearchPlanningPo searchPo = pageInfo.getRecords();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
searchPo.setCompanyId(tokenInfo.getCompanyId());
}
Page<FeePlanningVo> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<FeePlanningVo> selectPage = this.planningMapper.getDriverPlannings(page, searchPo);
PageInfo<List<FeePlanningVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(selectPage.getRecords());
return ResultVo.success(resultPageInfo);
}
@Override
public ResultVo listPlanningByContractId(TokenInfo tokenInfo, Integer contractId, Integer type) {
QueryWrapper<FeePlanning> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(FeePlanning::getCompanyId, tokenInfo.getCompanyId());
queryWrapper.lambda().eq(FeePlanning::getContractId, contractId);
if (type == 1) {
queryWrapper.lambda().eq(FeePlanning::getType, type);
} else {
queryWrapper.lambda().in(FeePlanning::getType, 2, 3);
}
queryWrapper.lambda().orderByAsc(FeePlanning::getName, FeePlanning::getPlanDate, FeePlanning::getId);
return ResultVo.success(this.list(queryWrapper));
}
@Override
public void saveFeePlanning(TokenInfo tokenInfo, Contract contract, List<CfgFeePo> fees) throws Exception {
if (fees == null || fees.isEmpty()) {
return;
}
for (CfgFeePo fee : fees) {
Date planningDate = contract.getStartDate();
Integer paidAmount = fee.getFirstPaidAmount();
while (true) {
FeePlanning planning = new FeePlanning();
planning.setType(2); // 费用项
planning.setName(fee.getName());
planning.setContractId(contract.getId());
planning.setContractType(contract.getType());
planning.setPlanDate(planningDate);
planning.setPayableAmount(fee.getAmount());
planning.setPaidAmount(0);
planning.setPaymentStatus(0); // 未付
planning.setCreateTime(new Date());
planning.setCreateById(tokenInfo.getId());
planning.setCreateByName(tokenInfo.getRealName());
planning.setCompanyId(tokenInfo.getCompanyId());
planning.setStatus(1);
this.save(planning);
// 生成付款日志
if (contract.getType() == ContractTypeEnum.DRIVER_CONTRACT.getKey() && paidAmount > 0) {
PayingPo payingPo = new PayingPo();
payingPo.setPlanningId(planning.getId());
payingPo.setAmount(paidAmount);
payingPo.setRemark("创建付款");
this.paying(tokenInfo, payingPo);
}
paidAmount = 0; // 仅首月
if (fee.getTiming() == FeeTimingEnum.ONCE.getKey()) { // 一次性费用
break;
} else if (fee.getTiming() == FeeTimingEnum.WEEK.getKey()) { // 周度费用
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 7);
} else if (fee.getTiming() == FeeTimingEnum.MONTH.getKey()) { // 月度费用
if (contract.getLeaseType() == LeaseTypeEnum.MONTH.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.MONTH, 1);
} else {
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 30);
}
} else if (fee.getTiming() == FeeTimingEnum.QUARTER.getKey()) { // 季度费用
if (contract.getLeaseType() == LeaseTypeEnum.MONTH.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.MONTH, 3);
} else {
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 30 * 3);
}
} else if (fee.getTiming() == FeeTimingEnum.YEAR.getKey()) { // 年度费用
if (contract.getLeaseType() == LeaseTypeEnum.MONTH.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.YEAR, 1);
} else {
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 30 * 12);
}
}
if (planningDate.getTime() >= contract.getEndDate().getTime()) {
break;
}
}
}
}
@Override
public void saveRentPlanning(TokenInfo tokenInfo, Contract contract, Integer firstPaidAmount) throws Exception {
Date planningDate = contract.getStartDate();
Integer paidAmount = firstPaidAmount;
while (true) {
FeePlanning planning = new FeePlanning();
planning.setType(1); // 租金
planning.setName("租金"); // 租金
planning.setContractId(contract.getId());
planning.setContractType(contract.getType());
planning.setPlanDate(planningDate);
planning.setPayableAmount(contract.getRentAmount());
planning.setPaidAmount(0);
planning.setPaymentStatus(0); // 未付
planning.setCreateTime(new Date());
planning.setCreateById(tokenInfo.getId());
planning.setCreateByName(tokenInfo.getRealName());
planning.setCompanyId(tokenInfo.getCompanyId());
planning.setStatus(1);
this.save(planning);
// 生成付款日志
if (contract.getType() == ContractTypeEnum.DRIVER_CONTRACT.getKey() && paidAmount > 0) {
PayingPo payingPo = new PayingPo();
payingPo.setPlanningId(planning.getId());
payingPo.setAmount(paidAmount);
payingPo.setRemark("创建付款");
this.paying(tokenInfo, payingPo);
}
// System.out.println("plan:" + planning.toString());
paidAmount = 0; // 仅首月
if (contract.getLeaseType() == LeaseTypeEnum.DAY_OF_MONTH.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 30);
} else if (contract.getLeaseType() == LeaseTypeEnum.MONTH.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.MONTH, 1);
} else if (contract.getLeaseType() == LeaseTypeEnum.WEEK.getKey()) {
planningDate = DateUtil.getAddTime(planningDate, Calendar.DATE, 7);
} else {
break;
}
if (planningDate.getTime() >= contract.getEndDate().getTime()) {
break;
}
}
}
@Override
public void saveDepositPlanning(TokenInfo tokenInfo, Contract contract) throws Exception {
Integer amount = contract.getPayableDepositAmount() - contract.getPaidDepositAmount();
if (amount <= 0) {
return;
}
Date planningDate = contract.getStartDate();
FeePlanning planning = new FeePlanning();
planning.setType(3); // 押金
planning.setName("押金"); // 押金
planning.setContractId(contract.getId());
planning.setContractType(contract.getType());
planning.setPlanDate(planningDate);
planning.setPayableAmount(amount);
planning.setPaidAmount(0);
planning.setPaymentStatus(0); // 未付
planning.setCreateTime(new Date());
planning.setCreateById(tokenInfo.getId());
planning.setCreateByName(tokenInfo.getRealName());
planning.setCompanyId(tokenInfo.getCompanyId());
planning.setStatus(1);
this.save(planning);
}
@Override
public void disablePlanningByContractId(Integer contractId) {
planningMapper.disablePlanningByContractId(contractId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo paying(TokenInfo tokenInfo, PayingPo payingPo) throws Exception {
if (payingPo.getAmount() <= 0) {
// return ResultVo.businessError("付款金额不正确");
throw new Exception("付款金额不正确");
}
FeePlanning planning = this.getById(payingPo.getPlanningId());
if (planning == null) {
// return ResultVo.businessError("该计划不存在");
throw new Exception("该计划不存在");
}
if (planning.getCompanyId() != tokenInfo.getCompanyId()) {
// return ResultVo.businessError("权限不足");
throw new Exception("权限不足");
}
planning.setPaidAmount(planning.getPaidAmount() + payingPo.getAmount());
if (planning.getPaidAmount() < planning.getPayableAmount()) {
planning.setPaymentStatus(1); // 已付部分
} else {
planning.setPaymentStatus(2); // 已付全部
}
this.updateById(planning);
if (planning.getType() == 3) {//押金 更新合同押金状态
Contract contract = this.contractService.getContractById(tokenInfo.getCompanyId(), planning.getContractId());
if (contract != null) {
contract.setPaidDepositAmount(contract.getPaidDepositAmount() + payingPo.getAmount());
if (contract.getPaidDepositAmount() >= contract.getPayableDepositAmount()) {
contract.setDepositStatus(DepositStatusEnum.NORMAL.getKey());
}
this.contractService.updateById(contract);
}
}
this.makePayingLog(tokenInfo, planning, payingPo);
return ResultVo.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo delay(TokenInfo tokenInfo, DelayPo delayPo) {
FeePlanning planning = this.getById(delayPo.getPlanningId());
if (planning == null) {
return ResultVo.businessError("该计划不存在");
}
if (planning.getCompanyId() != tokenInfo.getCompanyId()) {
return ResultVo.businessError("权限不足");
}
planning.setDelayDate(delayPo.getDelayDate());
this.updateById(planning);
this.makeDelayLog(tokenInfo, planning, delayPo);
return ResultVo.success();
}
@Override
public ResultVo listLogs(TokenInfo tokenInfo, PageInfo<SearchPlanningLogPo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
SearchPlanningLogPo searchPo = pageInfo.getRecords();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
searchPo.setCompanyId(tokenInfo.getCompanyId());
}
Page<PlanningOperationLogVo> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<PlanningOperationLogVo> selectPage = this.operationLogMapper.queryLogs(page, searchPo);
PageInfo<List<PlanningOperationLogVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(selectPage.getRecords());
return ResultVo.success(resultPageInfo);
}
private void makePayingLog(TokenInfo tokenInfo, FeePlanning planning, PayingPo payingPo) {
PlanningOperationLog operationLog = this.makeLog(tokenInfo, planning);
operationLog.setType(PlanningLogActionEnum.PAYING.getType());
operationLog.setAction(PlanningLogActionEnum.PAYING.getName());
operationLog.setAmount(payingPo.getAmount());
operationLog.setRemark(payingPo.getRemark());
operationLogMapper.insert(operationLog);
}
private void makeDelayLog(TokenInfo tokenInfo, FeePlanning planning, DelayPo delayPo) {
PlanningOperationLog operationLog = this.makeLog(tokenInfo, planning);
operationLog.setType(PlanningLogActionEnum.DELAY.getType());
operationLog.setAction(PlanningLogActionEnum.DELAY.getName());
StringAppend stringAppend = new StringAppend(",");
stringAppend.append(String.format("将延期日期修改为[%s]", DateUtil.format2Date(delayPo.getDelayDate())));
stringAppend.append(delayPo.getRemark());
operationLog.setRemark(stringAppend.toString());
operationLogMapper.insert(operationLog);
}
private PlanningOperationLog makeLog(TokenInfo tokenInfo, FeePlanning planning) {
PlanningOperationLog operationLog = new PlanningOperationLog();
operationLog.setContractId(planning.getContractId());
operationLog.setPlanningId(planning.getId());
operationLog.setCreateById(tokenInfo.getId());
operationLog.setCreateByName(tokenInfo.getRealName());
operationLog.setCreateTime(new Date());
operationLog.setCompanyId(tokenInfo.getCompanyId());
return operationLog;
}
@Override
public Integer getPlanAmountByPlanDate(TokenInfo tokenInfo, String date) {
Integer companyId = null;
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
companyId = tokenInfo.getCompanyId();
}
return planningMapper.getPlanAmountByPlanDate(companyId, date);
}
@Override
public Integer getActualAmountByCreateTime(TokenInfo tokenInfo, String date) {
Integer companyId = null;
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
companyId = tokenInfo.getCompanyId();
}
return planningMapper.getActualAmountByCreateTime(companyId, date);
}
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.Sequence;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.bo.VehicleLicense;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CreateVehiclePo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.po.UpdateVehiclePo;
import com.jair.entity.po.ValidateResult;
import com.jair.entity.vo.VehicleVo;
import com.jair.mapper.SequenceMapper;
import com.jair.mapper.VehicleMapper;
import com.jair.service.*;
import com.jair.util.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author Jair
* @since 2020-08-25
*/
@Service
public class SequenceServiceImpl extends ServiceImpl<SequenceMapper, Sequence> implements ISequenceService {
@Override
public Integer getSequence() {
Sequence sequence = new Sequence();
sequence.setName("");
this.save(sequence);
return sequence.getId();
}
}
package com.jair.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.Source;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SourcePo;
import com.jair.mapper.SourceMapper;
import com.jair.service.ISourceService;
import com.jair.util.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Date;
/**
* <p>
* 车源信息 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements ISourceService {
@Override
public ResultVo createSource(TokenInfo tokenInfo, SourcePo sourcePo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
if (StringUtils.isEmpty(sourcePo.getName())) {
return ResultVo.businessError("车源名称不能为空");
}
if (isSourceNameExists(tokenInfo.getCompanyId(), sourcePo.getId(), sourcePo.getName())) {
return ResultVo.businessError("车源名称已经存在");
}
Source source = BeanUtil.transform(sourcePo, Source.class);
source.setCreateTime(new Date());
source.setCreateById(tokenInfo.getId());
source.setCreateByName(tokenInfo.getRealName());
source.setCompanyId(tokenInfo.getCompanyId());
source.setStatus(1);
this.save(source);
return ResultVo.success();
}
@Override
public ResultVo updateSource(TokenInfo tokenInfo, SourcePo sourcePo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
if (StringUtils.isEmpty(sourcePo.getName())) {
return ResultVo.businessError("车源名称不能为空");
}
if (isSourceNameExists(tokenInfo.getCompanyId(), sourcePo.getId(), sourcePo.getName())) {
return ResultVo.businessError("车源名称已经存在");
}
Source source = this.getSourceById(tokenInfo.getCompanyId(), sourcePo.getId());
BeanUtil.copyProperties(sourcePo, source);
this.updateById(source);
return ResultVo.success();
}
@Override
public ResultVo updateSourceStatus(TokenInfo tokenInfo, SourcePo sourcePo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
Source source = this.getSourceById(tokenInfo.getCompanyId(), sourcePo.getId());
source.setStatus(sourcePo.getStatus());
this.updateById(source);
return ResultVo.success();
}
@Override
public ResultVo listSources(TokenInfo tokenInfo, SourcePo sourcePo) {
QueryWrapper<Source> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Source::getCompanyId, tokenInfo.getCompanyId());
if (sourcePo != null) {
if (!StringUtils.isEmpty(sourcePo.getName()))
queryWrapper.lambda().like(Source::getName, sourcePo.getName());
}
return ResultVo.success(this.list(queryWrapper));
}
@Override
public boolean isSourceNameExists(Integer companyId, Integer id, String sourceName) {
QueryWrapper<Source> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Source::getCompanyId, companyId);
queryWrapper.lambda().eq(Source::getName, sourceName);
if (id != null && id != 0) {
queryWrapper.lambda().ne(Source::getId, id);
}
Source source = this.getOne(queryWrapper);
if (source == null) {
return false;
}
return true;
}
@Override
public Source getSourceById(Integer companyId, Integer sourceId) {
QueryWrapper<Source> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Source::getId, sourceId);
queryWrapper.lambda().eq(Source::getCompanyId, companyId);
return this.getOne(queryWrapper);
}
}
package com.jair.service.impl;
import com.jair.entity.bo.VehicleLicense;
import com.jair.mapper.VehicleLicenseMapper;
import com.jair.service.IVehicleLicenseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 行驶证 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class VehicleLicenseServiceImpl extends ServiceImpl<VehicleLicenseMapper, VehicleLicense> implements IVehicleLicenseService {
}
package com.jair.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jair.entity.bo.AttFile;
import com.jair.entity.bo.Company;
import com.jair.entity.bo.Vehicle;
import com.jair.entity.bo.VehicleLicense;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.ResultVo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.CreateVehiclePo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.entity.po.UpdateVehiclePo;
import com.jair.entity.po.ValidateResult;
import com.jair.entity.vo.CompanyVo;
import com.jair.entity.vo.VehicleVo;
import com.jair.mapper.VehicleLicenseMapper;
import com.jair.mapper.VehicleMapper;
import com.jair.service.*;
import com.jair.util.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 车辆信息 服务实现类
* </p>
*
* @author Jair
* @since 2020-08-25
*/
@Service
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements IVehicleService {
@Autowired
private IVehicleLicenseService vehicleLicenseService;
@Autowired
private IContractService sourceContractService;
@Autowired
private IAttFileService attFileService;
@Autowired
private IDataService dataService;
@Autowired
private VehicleMapper vehicleMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo createVehicle(TokenInfo tokenInfo, CreateVehiclePo vehiclePo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
ValidateResult validate = vehiclePo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
if (isPlateNoExists(tokenInfo.getCompanyId(), null, vehiclePo.getPlateNo())) {
return ResultVo.businessError("车牌号已经存在");
}
VehicleLicense license = BeanUtil.transform(vehiclePo, VehicleLicense.class);
license.setCreateTime(new Date());
license.setCreateById(tokenInfo.getId());
license.setCreateByName(tokenInfo.getRealName());
license.setCompanyId(tokenInfo.getCompanyId());
vehicleLicenseService.save(license);
if (license.getLicenseId() == null || license.getLicenseId() == 0) {
return ResultVo.businessError("行驶证信息保存失败");
}
Vehicle vehicle = BeanUtil.transform(vehiclePo, Vehicle.class);
vehicle.setCreateTime(new Date());
vehicle.setCreateById(tokenInfo.getId());
vehicle.setCreateByName(tokenInfo.getRealName());
vehicle.setCompanyId(tokenInfo.getCompanyId());
vehicle.setLicenseId(license.getLicenseId());
vehicle.setStatus(1);
this.save(vehicle);
return ResultVo.success(vehicle);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVo updateVehicle(TokenInfo tokenInfo, UpdateVehiclePo vehiclePo) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
ValidateResult validate = vehiclePo.validate();
if (!validate.isSucceed()) {
return ResultVo.businessError(validate.getData());
}
Vehicle vehicle = this.getVehicleById(tokenInfo.getCompanyId(), vehiclePo.getId());
if (vehicle == null) {
return ResultVo.businessError("车辆不存在");
}
if (isPlateNoExists(tokenInfo.getCompanyId(), vehiclePo.getId(), vehiclePo.getPlateNo())) {
return ResultVo.businessError("车牌号已经存在");
}
BeanUtil.copyProperties(vehiclePo, vehicle);
VehicleLicense license = vehicleLicenseService.getById(vehicle.getLicenseId());
if (license != null) {
BeanUtil.copyProperties(vehiclePo, license);
}
this.updateById(vehicle);
this.vehicleLicenseService.updateById(license);
return ResultVo.success();
}
@Override
public ResultVo listVehicles(TokenInfo tokenInfo, PageInfo<SearchVechiclePo> pageInfo) {
pageInfo = PageInfo.checkParam(pageInfo);
SearchVechiclePo searchPo = pageInfo.getRecords();
QueryWrapper<Vehicle> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().like(Vehicle::getCompanyId, tokenInfo.getCompanyId());
}
if (!StringUtils.isEmpty(searchPo.getPlateNo())) {
queryWrapper.lambda().like(Vehicle::getPlateNo, searchPo.getPlateNo());
}
if (!StringUtils.isEmpty(searchPo.getBrandName())) {
queryWrapper.lambda().eq(Vehicle::getBrandName, searchPo.getBrandName());
}
Page<Vehicle> page = new Page<>(pageInfo.getCurrent(), pageInfo.getSize());
IPage<Vehicle> selectPage = this.page(page, queryWrapper);
List<VehicleVo> vehicleVos = new ArrayList<>();
if (selectPage.getRecords() != null) {
selectPage.getRecords().forEach(vehicle -> {
VehicleVo vehicleVo = translateVehicleToVo(tokenInfo, vehicle);
vehicleVos.add(vehicleVo);
// TODO 获取 合同状态
});
}
PageInfo<List<VehicleVo>> resultPageInfo = new PageInfo<>();
resultPageInfo.setCurrent(pageInfo.getCurrent());
resultPageInfo.setSize(pageInfo.getSize());
resultPageInfo.setTotal(selectPage.getTotal());
resultPageInfo.setRecords(vehicleVos);
return ResultVo.success(resultPageInfo);
}
@Override
public ResultVo listNoSourceContractVehicles(TokenInfo tokenInfo) {
return ResultVo.success(vehicleMapper.listNoSourceContractVehicles(tokenInfo.getCompanyId()));
}
@Override
public ResultVo listAllowRentVehicles(TokenInfo tokenInfo) {
return ResultVo.success(vehicleMapper.listAllowRentVehicles(tokenInfo.getCompanyId()));
}
@Override
public ResultVo returnVehicle(TokenInfo tokenInfo, Integer vehicleId) {
if (tokenInfo.getCompanyId() == null || tokenInfo.getCompanyId() <= 0) {
return ResultVo.businessError("未知的企业帐号");
}
Vehicle vehicle = getVehicleById(tokenInfo.getCompanyId(), vehicleId);
if (vehicle == null) {
return ResultVo.businessError("未找到该车辆");
}
if (sourceContractService.checkInEffectContract(vehicle.getId(), null)) {
return ResultVo.businessError("该车辆存在生效的合同,不能进行退车操作");
}
// TODO 检查司机合同
vehicle.setStatus(0);
this.updateById(vehicle);
return ResultVo.success();
}
@Override
public boolean isPlateNoExists(Integer companyId, Integer vehicleId, String plateNo) {
QueryWrapper<Vehicle> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Vehicle::getCompanyId, companyId);
queryWrapper.lambda().eq(Vehicle::getPlateNo, plateNo);
if (vehicleId != null) {
queryWrapper.lambda().ne(Vehicle::getId, vehicleId);
}
if (this.getOne(queryWrapper) == null) {
return false;
}
return true;
}
@Override
public ResultVo getVehicleById(TokenInfo tokenInfo, Integer vehicleId) {
Vehicle vehicle = this.getVehicleById(tokenInfo.getCompanyId(), vehicleId);
VehicleVo vehicleVo = this.translateVehicleToVo(tokenInfo, vehicle);
return ResultVo.success(vehicleVo);
}
@Override
public Vehicle getVehicleById(Integer companyId, Integer vehicleId) {
QueryWrapper<Vehicle> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Vehicle::getId, vehicleId);
queryWrapper.lambda().eq(Vehicle::getCompanyId, companyId);
return this.getOne(queryWrapper);
}
@Override
public VehicleVo translateVehicleToVo(TokenInfo tokenInfo, Vehicle vehicle) {
VehicleVo vehicleVo = BeanUtil.transform(vehicle, VehicleVo.class);
VehicleLicense license = this.vehicleLicenseService.getById(vehicle.getLicenseId());
if (license != null) {
BeanUtil.copyProperties(license, vehicleVo);
vehicleVo.setBrandId(dataService.getBrandIdByName(tokenInfo, vehicle.getBrandName()));
if (license.getMainFileId() != null) {
AttFile attFile = attFileService.getAttFileById(vehicle.getCompanyId(), license.getMainFileId());
if (attFile != null) {
vehicleVo.setMainFileUrl(attFile.getFilePath());
}
}
if (license.getSecondFileId() != null) {
AttFile attFile = attFileService.getAttFileById(vehicle.getCompanyId(), license.getSecondFileId());
if (attFile != null) {
vehicleVo.setSecondFileUrl(attFile.getFilePath());
}
}
}
return vehicleVo;
}
@Override
public Integer getAllVehicleCount(TokenInfo tokenInfo) {
QueryWrapper<Vehicle> queryWrapper = new QueryWrapper<>();
if (tokenInfo.getType() != AccountTypeEnum.ADMIN.getKey()) {
queryWrapper.lambda().eq(Vehicle::getCompanyId, tokenInfo.getCompanyId());
}
return this.count(queryWrapper);
}
}
package com.jair.timer;
import com.jair.service.ICompanyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class CompanyExpiredTimer {
@Autowired
private ICompanyService companyService;
@Scheduled(cron = "0 0 0/4 * * ?")
synchronized public void execute() {
companyService.checkExpiredCompanys();
}
}
package com.jair.timer;
import com.jair.service.ICompanyService;
import com.jair.service.IContractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class ContractEndedTimer {
@Autowired
private IContractService contractService;
@Scheduled(cron = "0 0 0/4 * * ?")
synchronized public void execute() {
contractService.checkEndedContracts();
}
}
package com.jair.util;
import java.util.ArrayList;
import java.util.List;
public class ArrayUtil {
public static <T> boolean isEmtry(List<T> t){
if(t==null || t.size()==0){
return true;
}
return false;
}
public static <T> boolean isNotEmtry(List<T> ts){
return !isEmtry(ts);
}
/*
将一组数据固定分组,每组n个元素
@param source 要分组的数据源
@param n 每组n个元素
@param
@return
*/
public static <T> List<List<T>> fixedGrouping(List<T> source, int n) {
if (null == source || source.size() == 0 || n <= 0)
return null;
List<List<T>> result = new ArrayList<List<T>>();
int sourceSize = source.size();
int size = (source.size() / n) + 1;
for (int i = 0; i < size; i++) {
List subset = new ArrayList();
for (int j = i * n; j < (i + 1) * n; j++) {
if (j < sourceSize) {
subset.add(source.get(j));
}
}
result.add(subset);
}
return result;
}
}
package com.jair.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jair.entity.bo.VehicleLicense;
import com.jair.entity.vo.DrivingLicenseVo;
import com.jair.entity.vo.IdentityCardVo;
import com.jair.entity.vo.VehicleLicenseDetectVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
@Service
@Slf4j
public class BaiduAI {
private static final String BASE_URL = "https://aip.baidubce.com";
private static final String URL_BAIDU_TOKEN = BASE_URL + "/oauth/2.0/token?grant_type=client_credentials&client_id=%s&client_secret=%s";
private static final String URL_BAIDU_TEXT_DETECT = BASE_URL + "/rest/2.0/ocr/v1/general_basic?charset=UTF-8&access_token=%s";
private static final String URL_BAIDU_VEHICLE_LICENSE = BASE_URL + "/rest/2.0/ocr/v1/vehicle_license?access_token=%s";
private static final String URL_BAIDU_IDCARD = BASE_URL + "/rest/2.0/ocr/v1/idcard?access_token=%s";
private static final String URL_BAIDU_DRIVER_LICENSE = BASE_URL + "/rest/2.0/ocr/v1/driving_license?access_token=%s";
private static final String APP_ID = "18029293";
private static final String APP_KEY = "kibweDD5PsLfu9exll0pMVet";
private static final String SECRET_KEY = "RwBcY9mbPLLhLqWMwjA7LMYEfnGSVsLS";
public VehicleLicenseDetectVo vehicleLicenseDetect(String imageUrl, boolean isMain) throws Exception {
return vehicleLicenseDetect(getBytesByUrl(imageUrl), isMain);
}
public VehicleLicenseDetectVo vehicleLicenseDetect(File image, boolean isMain) throws Exception {
FileInputStream fis = new FileInputStream(image);
byte[] bytes = readNBytes(fis);
return vehicleLicenseDetect(bytes, isMain);
}
public IdentityCardVo identityCardDetect(String imageUrl, boolean isMain) throws Exception {
return identityCardDetect(getBytesByUrl(imageUrl), isMain);
}
public IdentityCardVo identityCardDetect(File image, boolean isMain) throws Exception {
FileInputStream fis = new FileInputStream(image);
byte[] bytes = readNBytes(fis);
return identityCardDetect(bytes, isMain);
}
public DrivingLicenseVo drivingLicenseDetect(String imageUrl) throws Exception {
return drivingLicenseDetect(getBytesByUrl(imageUrl));
}
public DrivingLicenseVo drivingLicenseDetect(File image) throws Exception {
FileInputStream fis = new FileInputStream(image);
byte[] bytes = readNBytes(fis);
return drivingLicenseDetect(bytes);
}
public VehicleLicenseDetectVo vehicleLicenseDetect(byte[] imageBytes, boolean isMain) throws Exception {
String accessToken = getAccessToken();
String base64 = Base64.getEncoder().encodeToString(imageBytes);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("image", base64);
parameters.add("detect_direction", "true");
parameters.add("vehicle_license_side", isMain ? "front" : "back");
parameters.add("unified", "true");
// System.out.println(base64);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<MultiValueMap> requestEntity = new HttpEntity<>(parameters, headers);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(URL_BAIDU_VEHICLE_LICENSE, accessToken), requestEntity, String.class);
// {"log_id": 3374241317740710780, "words_result_num": 1, "words_result": [{"words": "m AL"}], "language": 0}
String body = responseEntity.getBody();
System.out.println(body);
JSONObject wordsResult = JSON.parseObject(body).getJSONObject("words_result");
VehicleLicenseDetectVo license = new VehicleLicenseDetectVo();
license.setPlateNo(wordsResult.getJSONObject("号牌号码") != null ? wordsResult.getJSONObject("号牌号码").getString("words") : null);
license.setVin(wordsResult.getJSONObject("车辆识别代号") != null ? wordsResult.getJSONObject("车辆识别代号").getString("words") : null);
license.setEngineNo(wordsResult.getJSONObject("发动机号码") != null ? wordsResult.getJSONObject("发动机号码").getString("words") : null);
license.setLicenseModel(wordsResult.getJSONObject("品牌型号") != null ? wordsResult.getJSONObject("品牌型号").getString("words") : null);
license.setType(wordsResult.getJSONObject("车辆类型") != null ? wordsResult.getJSONObject("车辆类型").getString("words") : null);
license.setUseCharacter(wordsResult.getJSONObject("使用性质") != null ? wordsResult.getJSONObject("使用性质").getString("words") : null);
license.setOwner(wordsResult.getJSONObject("所有人") != null ? wordsResult.getJSONObject("所有人").getString("words") : null);
license.setAddress(wordsResult.getJSONObject("住址") != null ? wordsResult.getJSONObject("住址").getString("words") : null);
license.setApprovedPerson(wordsResult.getJSONObject("核定载人数") != null ? wordsResult.getJSONObject("核定载人数").getString("words") : null);
license.setWeight(wordsResult.getJSONObject("总质量") != null ? wordsResult.getJSONObject("总质量").getString("words") : null);
license.setOutlineSize(wordsResult.getJSONObject("外廓尺寸") != null ? wordsResult.getJSONObject("外廓尺寸").getString("words") : null);
license.setIssueDate(wordsResult.getJSONObject("发证日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("发证日期").getString("words")) : null);
license.setRegisterDate(wordsResult.getJSONObject("注册日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("注册日期").getString("words")) : null);
return license;
}
public IdentityCardVo identityCardDetect(byte[] imageBytes, boolean isMain) throws Exception {
String accessToken = getAccessToken();
String base64 = Base64.getEncoder().encodeToString(imageBytes);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("image", base64);
parameters.add("detect_direction", "true");
parameters.add("id_card_side", isMain ? "front" : "back");
parameters.add("detect_risk", "true");
parameters.add("detect_photo", "false");
parameters.add("detect_rectify", "true");
// System.out.println(base64);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<MultiValueMap> requestEntity = new HttpEntity<>(parameters, headers);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(URL_BAIDU_IDCARD, accessToken), requestEntity, String.class);
// {"log_id": 3374241317740710780, "words_result_num": 1, "words_result": [{"words": "m AL"}], "language": 0}
String body = responseEntity.getBody();
System.out.println(body);
JSONObject wordsResult = JSON.parseObject(body).getJSONObject("words_result");
IdentityCardVo idCard = new IdentityCardVo();
idCard.setName(wordsResult.getJSONObject("姓名") != null ? wordsResult.getJSONObject("姓名").getString("words") : null);
idCard.setNation(wordsResult.getJSONObject("民族") != null ? wordsResult.getJSONObject("民族").getString("words") : null);
idCard.setOriginAddress(wordsResult.getJSONObject("住址") != null ? wordsResult.getJSONObject("住址").getString("words") : null);
idCard.setIdentityNumber(wordsResult.getJSONObject("公民身份号码") != null ? wordsResult.getJSONObject("公民身份号码").getString("words") : null);
idCard.setBirthday(wordsResult.getJSONObject("出生") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("出生").getString("words")) : null);
idCard.setGender(wordsResult.getJSONObject("性别") != null ? wordsResult.getJSONObject("性别").getString("words") : null);
idCard.setIssueOrganization(wordsResult.getJSONObject("签发机关") != null ? wordsResult.getJSONObject("签发机关").getString("words") : null);
idCard.setValidPeriodStart(wordsResult.getJSONObject("签发日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("签发日期").getString("words")) : null);
idCard.setValidPeriodEnd(wordsResult.getJSONObject("失效日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("失效日期").getString("words")) : null);
return idCard;
}
public DrivingLicenseVo drivingLicenseDetect(byte[] imageBytes) throws Exception {
String accessToken = getAccessToken();
String base64 = Base64.getEncoder().encodeToString(imageBytes);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("image", base64);
parameters.add("detect_direction", "true");
parameters.add("unified_valid_period", "true");
// System.out.println(base64);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<MultiValueMap> requestEntity = new HttpEntity<>(parameters, headers);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(URL_BAIDU_DRIVER_LICENSE, accessToken), requestEntity, String.class);
// {"log_id": 3374241317740710780, "words_result_num": 1, "words_result": [{"words": "m AL"}], "language": 0}
String body = responseEntity.getBody();
System.out.println(body);
JSONObject wordsResult = JSON.parseObject(body).getJSONObject("words_result");
DrivingLicenseVo license = new DrivingLicenseVo();
license.setName(wordsResult.getJSONObject("姓名") != null ? wordsResult.getJSONObject("姓名").getString("words") : null);
license.setCredentialNo(wordsResult.getJSONObject("证号") != null ? wordsResult.getJSONObject("证号").getString("words") : null);
license.setAddress(wordsResult.getJSONObject("住址") != null ? wordsResult.getJSONObject("住址").getString("words") : null);
license.setCountry(wordsResult.getJSONObject("国籍") != null ? wordsResult.getJSONObject("国籍").getString("words") : null);
license.setDrivingClass(wordsResult.getJSONObject("准驾车型") != null ? wordsResult.getJSONObject("准驾车型").getString("words") : null);
license.setFirstIssue(wordsResult.getJSONObject("初次领证日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("初次领证日期").getString("words")) : null);
license.setValidPeriodStart(wordsResult.getJSONObject("有效起始日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("有效起始日期").getString("words")) : null);
license.setValidPeriodEnd(wordsResult.getJSONObject("失效日期") != null ? DateUtil.parseBrithday(wordsResult.getJSONObject("失效日期").getString("words")) : null);
return license;
}
public String textDetect(File image) throws Exception {
String accessToken = getAccessToken();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
FileInputStream fis = new FileInputStream(image);
byte[] bytes = readNBytes(fis);
// byte[] bytes = fis.readAllBytes();
// System.out.println(bytes.length);
String base64 = Base64.getEncoder().encodeToString(bytes);
parameters.add("image", base64);
parameters.add("language_type", "ENG");
parameters.add("detect_language", "true");
// System.out.println(base64);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(parameters, headers);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(URL_BAIDU_TEXT_DETECT, accessToken), requestEntity, String.class);
// {"log_id": 3374241317740710780, "words_result_num": 1, "words_result": [{"words": "m AL"}], "language": 0}
String body = responseEntity.getBody();
// System.out.println(body);
JSONArray wordsResult = JSON.parseObject(body).getJSONArray("words_result");
StringBuffer word = new StringBuffer();
wordsResult.forEach(item -> {
String text = JSON.parseObject(item.toString()).getString("words");
if (StringUtils.isEmpty(text)) {
return;
}
word.append(text);
});
return word.toString();
}
private String getAccessToken() {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(URL_BAIDU_TOKEN, APP_KEY, SECRET_KEY), null, String.class);
String body = responseEntity.getBody();
return JSON.parseObject(body).getString("access_token");
}
private static final int DEFAULT_BUFFER_SIZE = 8192;
private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8;
public static byte[] readNBytes(InputStream fis) throws IOException {
int len = Integer.MAX_VALUE;
if (len < 0) {
throw new IllegalArgumentException("len < 0");
}
List<byte[]> bufs = null;
byte[] result = null;
int total = 0;
int remaining = len;
int n;
do {
byte[] buf = new byte[Math.min(remaining, DEFAULT_BUFFER_SIZE)];
int nread = 0;
// read to EOF which may read more or less than buffer size
while ((n = fis.read(buf, nread,
Math.min(buf.length - nread, remaining))) > 0) {
nread += n;
remaining -= n;
}
if (nread > 0) {
if (MAX_BUFFER_SIZE - total < nread) {
throw new OutOfMemoryError("Required array size too large");
}
total += nread;
if (result == null) {
result = buf;
} else {
if (bufs == null) {
bufs = new ArrayList<>();
bufs.add(result);
}
bufs.add(buf);
}
}
// if the last call to read returned -1 or the number of bytes
// requested have been read then break
} while (n >= 0 && remaining > 0);
if (bufs == null) {
if (result == null) {
return new byte[0];
}
return result.length == total ?
result : Arrays.copyOf(result, total);
}
result = new byte[total];
int offset = 0;
remaining = total;
for (byte[] b : bufs) {
int count = Math.min(b.length, remaining);
System.arraycopy(b, 0, result, offset, count);
offset += count;
remaining -= count;
}
return result;
}
public static byte[] getBytesByUrl(String url) throws Exception {
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//缓存2KB
final int BUFFER_SIZE = 4 * 1024;
final int EOF = -1;
int c;
byte[] buf = new byte[BUFFER_SIZE];
while (true) {
c = bis.read(buf);
if (c == EOF)
break;
baos.write(buf, 0, c);
}
conn.disconnect();
is.close();
byte[] data = baos.toByteArray();
baos.flush();
return data;
}
}
package com.jair.util;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
/**
* 类型转化
*/
@Slf4j
public class BeanUtil {
public static <T> T transform(Object object, Class<T> tClass) {
if (object == null || tClass == null) {
return null;
}
try {
T t = JSONObject.parseObject(JSONObject.toJSONString(object), tClass);
return t;
} catch (Exception e) {
log.error("类型转化错误", e, e.getMessage());
e.printStackTrace();
}
return null;
}
// public static <T, E> List<T> transformArray(List<E> list, Class<T> tClass) {
// if (ArrayUtil.isEmtry(list)) {
// return new ArrayList<>();
// }
// try {
// List<T> t = list.stream().map(e -> BeanUtil.transform(e, tClass)).collect(Collectors.toList());
// return t;
// } catch (Exception e) {
// log.error("类型转化错误", e, e.getMessage());
// e.printStackTrace();
// }
// return null;
// }
public static void copyProperties(Object source, Object target) {
BeanUtils.copyProperties(source, target);
}
// /**
// * 获取类的全部变量
// *
// * @param t
// * @param <T>
// * @return
// */
// public static <T> List<Field> getFields(T t) {
// List<Field> fieldList = new ArrayList<>();
// Class tempClass = t.getClass();
// while (tempClass != null) {//当父类为null的时候说明到达了最上层的父类(Object类).
// fieldList.addAll(Arrays.asList(tempClass.getDeclaredFields()));
// tempClass = tempClass.getSuperclass(); //得到父类,然后赋给自己
// }
// return fieldList;
// }
}
package com.jair.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class DateUtil {
public static String YYYYMMDD = "yyyyMMdd";
public static String YYMMDD = "yyMMdd";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYY_MM_DDHHMMSS = "yyyy-MM-dd HH:mm:ss";
public static Date getAddDayTime(Integer num) {
return getAddTime(Calendar.DATE, num);
}
public static Date getAddTime(Integer type, Integer num) {
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(type, num);
date = calendar.getTime();
return date;
}
public static Date getAddTime(Date date, Integer type, Integer num) {
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(type, num);
date = calendar.getTime();
// calendar.add(calendar.YEAR, 1);//把日期往后增加一年.整数往后推,负数往前移动
// calendar.add(calendar.DAY_OF_MONTH, 1);//把日期往后增加一个月.整数往后推,负数往前移动
// calendar.add(calendar.DATE, 1);//把日期往后增加一天.整数往后推,负数往前移动
// calendar.add(calendar.WEEK_OF_MONTH, 1);//把日期往后增加一周.整数往后推,负数往前移动
return date;
}
public static String format2Datetime(Date date) {
SimpleDateFormat sdfTime = new SimpleDateFormat(YYYY_MM_DDHHMMSS);
return sdfTime.format(date);
}
public static String format2Date(Date date) {
return format2Date(date, YYYY_MM_DD);
}
public static String format2Date(Date date, String format) {
SimpleDateFormat sdfTime = new SimpleDateFormat(format);
return sdfTime.format(date);
}
public static Date parseDate(String date,String format) throws ParseException {
return new SimpleDateFormat(format).parse(date);
}
public static Date parseDate(String date) throws ParseException {
return new SimpleDateFormat(YYYY_MM_DD).parse(date);
}
public static Date parseBrithday(String date) throws ParseException {
return new SimpleDateFormat(YYYYMMDD).parse(date);
}
}
package com.jair.util;
import java.util.Date;
public class ObjectUtil {
public static boolean equals(Object obj1, Object obj2) {
if (obj1 == null && obj2 == null) {
return true;
}
if (obj1 == null || obj2 == null) {
return false;
}
if (obj1 instanceof Integer) {
return ((Integer) obj1).intValue() == ((Integer) obj2).intValue();
}
if (obj1 instanceof Long) {
return ((Long) obj1).longValue() == ((Long) obj2).longValue();
}
if (obj1 instanceof String) {
return obj1.equals(obj2);
}
if (obj1 instanceof Date) {
return ((Date) obj1).getTime() == ((Date) obj2).getTime();
}
return false;
}
}
package com.jair.util;
import org.springframework.util.StringUtils;
import java.util.List;
public class StringAppend {
public static final String SPLITER_ENTER = "\n";
private StringBuffer stringBuffer = new StringBuffer();
private String spliter = "";
public StringAppend(String spliter) {
this.spliter = spliter;
}
public StringAppend append(StringAppend stringAppend) {
this.append(stringAppend.toString());
return this;
}
public StringAppend append(String string) {
if (StringUtils.isEmpty(string)) {
return this;
}
if (stringBuffer.length() > 0) {
stringBuffer.append(spliter);
}
stringBuffer.append(string);
return this;
}
public StringAppend append(List<String> list) {
if (list == null || list.isEmpty()) {
return this;
}
list.forEach(item -> {
this.append(item);
});
return this;
}
@Override
public String toString() {
return stringBuffer.toString();
}
public boolean isEmpty() {
return StringUtils.isEmpty(this.toString());
}
}
package com.jair.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jair.entity.common.AppInfo;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
import org.apache.tomcat.util.codec.binary.Base64;
import org.apache.tomcat.util.security.ConcurrentMessageDigest;
import org.apache.tomcat.util.security.MD5Encoder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
@Component
@Slf4j
public class UploadUtil {
public static AppInfo appInfo;
private static String thirdId = "1539894";
private static String appKey = "jdGcS9oq0fEatFIX";
private static String appSecret = "c3ae6bbbeb60cc84b802e09bf597bbe1d750db3e";
private static String HTTP_HOST = "https://api.sskuaixiu.com";
// private static String thirdId = "8907926";
// private static String appKey = "oTXosH5OVKYWtqBS";
// private static String appSecret = "2b35c294cdcdeafa979baf59756ae41026693a7e";
// private static String HTTP_HOST = "https://apitest.sskuaixiu.com";
private static String TOKEN_URL = HTTP_HOST + "/openapi/token/get";
private static String UPLOAD_URL = HTTP_HOST + "/openapi/b2b-biz/file/upload";
public void getAppInfo() throws Exception {
if (checkToken()) {
return;
}
// System.out.println("getAppInfo");
RestTemplate restTemplate = new RestTemplate();
String timestamp = String.valueOf(new Date().getTime());
String encryptedSecret = MD5Encoder.encode(ConcurrentMessageDigest.digestMD5((appSecret + timestamp).getBytes()));
JSONObject jsonObject = new JSONObject();
jsonObject.put("appKey", appKey);
jsonObject.put("encryptedSecret", encryptedSecret);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
httpHeaders.add("third-id", thirdId);
httpHeaders.add("timestamp", timestamp);
HttpEntity<String> entity = new HttpEntity<>(jsonObject.toJSONString(), httpHeaders);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(TOKEN_URL, entity, String.class);
AppInfo token = JSON.parseObject(JSON.parseObject(responseEntity.getBody()).getString("data"), AppInfo.class);
if (token == null || StringUtils.isEmpty(token.getToken())) {
throw new Exception("获取token失败");
}
System.out.println("appInfo:" + JSON.toJSONString(token));
appInfo = token;
}
public String upload(MultipartFile multipartFile) throws Exception {
this.getAppInfo();
RestTemplate restTemplate = new RestTemplate();
String timestamp = String.valueOf(new Date().getTime());
FileReq fileReq = new FileReq();
fileReq.setFileName(multipartFile.getOriginalFilename());
fileReq.setBytes(getFileBytes(multipartFile));
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String params = objectMapper.writeValueAsString(fileReq);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
httpHeaders.add("third-id", thirdId);
httpHeaders.add("timestamp", timestamp);
httpHeaders.add("token", appInfo.getToken());
httpHeaders.add("sign", generatorSign(params, appInfo.getToken(), timestamp));
HttpEntity<String> entity = new HttpEntity<>(params, httpHeaders);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(UPLOAD_URL, entity, String.class);
return JSON.parseObject(responseEntity.getBody()).getString("data");
}
private boolean checkToken() {
if (appInfo == null) {
return false;
}
Integer duration = appInfo.getActiveDuration() - 60 * 60;
Date current = new Date();
Date expiredDate = DateUtil.getAddTime(appInfo.getGenerateTime(), Calendar.SECOND, duration);
if (current.getTime() >= expiredDate.getTime()) {
return false;
}
return true;
}
public byte[] getFileBytes(MultipartFile multipartFile) throws Exception {
return readAllBytes(multipartFile.getInputStream());
}
public byte[] getFileBytes(String filename) throws Exception {
return readAllBytes(new FileInputStream(new File(filename)));
}
public static String generatorSign(String body, String token, String timestamp) {
// ObjectMapper objMapper = new ObjectMapper();
// objMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
// Map<String, Object> dataMap = objMapper.convertValue(body, Map.class);
Map<String, Object> dataMap = JSON.parseObject(body, Map.class);
List<Map.Entry<String, Object>> dataList = dataMap.entrySet().stream()
.filter(entry -> StringUtils.isNotEmpty(entry.getKey()) && null != entry.getValue())
.collect(Collectors.toList());
dataList.sort(Comparator.comparing(Map.Entry::getKey));
String dataListStr = JSONObject.toJSONString(dataList);
if (dataListStr.length() > 1024) {
dataListStr = dataListStr.substring(0, 512) + "......" + dataListStr.substring(dataListStr.length() - 512);
}
log.info("签名数据:dataList={}", dataListStr);
StringBuilder sb = new StringBuilder();
dataList.stream().filter(item -> item.getValue() != null && StringUtils.isNotEmpty(item.getValue().toString()))
.forEach(item -> sb.append(item.getKey()).append("=").append(item.getValue()).append("&"));
sb.append("secret").append("=").append(appSecret).append("&");
sb.append("token").append("=").append(token).append(timestamp);
String signStr = sb.toString();
if (signStr.length() > 2 * 1024) {
signStr = signStr.substring(0, 1024) + "......" + signStr.substring(signStr.length() - 1024);
}
log.info("待加密字符串为:{}", signStr);
HmacUtils hmacUtils = new HmacUtils(HmacAlgorithms.HMAC_SHA_256, appSecret.getBytes());
return Base64.encodeBase64String(hmacUtils.hmac(sb.toString()));
}
public static byte[] readAllBytes(InputStream fis) throws IOException {
int len = 2147483647;
if (len < 0) {
throw new IllegalArgumentException("len < 0");
} else {
List<byte[]> bufs = null;
byte[] result = null;
int total = 0;
int remaining = len;
int n;
do {
byte[] buf = new byte[Math.min(remaining, 8192)];
int nread;
for (nread = 0; (n = fis.read(buf, nread, Math.min(buf.length - nread, remaining))) > 0; remaining -= n) {
nread += n;
}
if (nread > 0) {
if (2147483639 - total < nread) {
throw new OutOfMemoryError("Required array size too large");
}
total += nread;
if (result == null) {
result = buf;
} else {
if (bufs == null) {
bufs = new ArrayList();
bufs.add(result);
}
bufs.add(buf);
}
}
} while (n >= 0 && remaining > 0);
if (bufs == null) {
if (result == null) {
return new byte[0];
} else {
return result.length == total ? result : Arrays.copyOf(result, total);
}
} else {
result = new byte[total];
int offset = 0;
remaining = total;
int count;
for (Iterator var12 = bufs.iterator(); var12.hasNext(); remaining -= count) {
byte[] b = (byte[]) var12.next();
count = Math.min(b.length, remaining);
System.arraycopy(b, 0, result, offset, count);
offset += count;
}
return result;
}
}
}
@Data
class FileReq {
private String fileName;
private byte[] bytes;
}
}
spring:
application:
name: tsndu-service
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
# todo 修改数据源
# url: jdbc:mysql://127.0.0.1:3306/jair?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL
# driver-class-name: com.mysql.cj.jdbc.Driver
# username: root
# password: 12345678
url: jdbc:mysql://140.143.224.240:3306/tsndu?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL
driver-class-name: com.mysql.cj.jdbc.Driver
username: tsndu
password: WdxAJA8IDkAgEw5z
initial-size: 1
max-active: 20
min-idle: 1
max-wait: 60000
validation-query: SELECT 'x'
test-on-borrow: false
test-on-return: false
test-while-idle: true
servlet:
multipart:
max-file-size: 30MB
max-request-size: 30MB
server:
port: 8088
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
logging:
level:
com.jair.mapper: trace # 改成你的mapper文件所在包路径
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.AccountMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.AttFileMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.CfgDataMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.CfgFeeMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.CompanyMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.ContractSignAttachmentMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.ContractMapper">
<select id="queryDriverContracts" resultType="com.jair.entity.bo.Contract">
<if test="searcher.type == 1">
SELECT c.* FROM contract AS c
JOIN vehicle v ON c.vehicle_id = v.id
WHERE
c.`type` = #{searcher.type}
</if>
<if test="searcher.type == 2">
SELECT c.* FROM contract AS c
JOIN driver d ON c.driver_id = d.id
JOIN vehicle v ON c.vehicle_id = v.id
WHERE
c.`type` = #{searcher.type}
</if>
<if test="searcher.companyId != null">
AND c.company_id = #{searcher.companyId}
</if>
<if test="searcher.sourceId != null and searcher.sourceId != 0">
AND c.source_id = #{searcher.sourceId}
</if>
<if test="searcher.status != null">
AND c.status = #{searcher.status}
</if>
<if test="searcher.depositStatus != null">
AND c.deposit_status in
<foreach collection="searcher.depositStatus" item="depositStatus" open="(" separator="," close=")">
#{depositStatus}
</foreach>
</if>
<if test="searcher.driverInfo != null and searcher.driverInfo != ''">
AND (d.name LIKE CONCAT('%',#{searcher.driverInfo},'%') OR d.phone LIKE CONCAT('%',#{searcher.driverInfo},'%') OR d.identity_number LIKE CONCAT('%', #{searcher.driverInfo}, '%'))
</if>
<if test="searcher.vehicleInfo != null and searcher.vehicleInfo != ''">
AND (v.plate_no LIKE CONCAT('%',#{searcher.vehicleInfo},'%') OR v.model LIKE CONCAT('%',#{searcher.vehicleInfo},'%'))
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.ContractOperationLogMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.ContractReturnVehicleAttachmentMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.ContractReturnVehicleMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.DriverMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.DrivingLicenseMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.FeePlanningMapper">
<update id="disablePlanningByContractId">
update fee_planning set status = 0 where contract_id = #{contractId}
</update>
<select id="getDriverPlannings" resultType="com.jair.entity.vo.FeePlanningVo">
SELECT p.*,
c.code AS contractCode,
d.id AS driverId, d.name AS driverName,
v.id AS vehicleId, v.plate_no AS plateNo
FROM fee_planning p
JOIN contract c ON p.contract_id = c.id
JOIN driver d ON c.driver_id = d.id
JOIN vehicle v ON c.vehicle_id = v.id
WHERE p.contract_type = 2
<if test="searcher.companyId != null">
AND p.company_id = #{searcher.companyId}
</if>
<if test="searcher.type != null">
AND p.`type` = #{searcher.type}
</if>
<if test="searcher.typeName != null and searcher.typeName != ''">
AND p.name LIKE CONCAT('%', #{searcher.typeName}, '%')
</if>
<if test="searcher.driverInfo != null and searcher.driverInfo != ''">
AND (d.name LIKE CONCAT('%', #{searcher.driverInfo}, '%') OR d.phone LIKE CONCAT('%', #{searcher.driverInfo}, '%') OR d.identity_number LIKE CONCAT('%', #{searcher.driverInfo}, '%'))
</if>
<if test="searcher.vehicleInfo != null and searcher.vehicleInfo != ''">
AND (v.plate_no LIKE CONCAT('%', #{searcher.vehicleInfo}, '%') OR v.model LIKE CONCAT('%', #{searcher.vehicleInfo}, '%'))
</if>
<if test="searcher.planDateStart != null">
<![CDATA[ AND (p.plan_date >= #{searcher.planDateStart} OR p.delay_date >= #{searcher.planDateStart}) ]]>
</if>
<if test="searcher.planDateEnd != null">
<![CDATA[ AND (p.plan_date <= #{searcher.planDateEnd} OR p.delay_date <= #{searcher.planDateEnd}) ]]>
</if>
<if test="searcher.paymentStatus != null">
<if test="searcher.paymentStatus == 2">
AND p.payment_status = #{searcher.paymentStatus}
</if>
<if test="searcher.paymentStatus != 2">
AND (p.payment_status = 0 OR p.payment_status = 1)
</if>
</if>
<if test="searcher.status != null">
AND p.status = #{searcher.status}
</if>
</select>
<select id="getPlanAmountByPlanDate" resultType="java.lang.Integer">
SELECT sum(payable_amount) FROM fee_planning
WHERE (plan_date LIKE CONCAT('%', #{date}, '%') OR delay_date LIKE CONCAT('%', #{date}, '%'))
AND status = 1 AND contract_type = 2
<if test="companyId != null">
AND company_id = #{companyId}
</if>
</select>
<select id="getActualAmountByCreateTime" resultType="java.lang.Integer">
SELECT sum(paid_amount) FROM fee_planning
WHERE (plan_date LIKE CONCAT('%', #{date}, '%') OR delay_date LIKE CONCAT('%', #{date}, '%'))
AND contract_type = 2
<if test="companyId != null">
AND company_id = #{companyId}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.IdentityCardMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.MenuMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.MotorcadeMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.PlanningOperationLogMapper">
<select id="queryLogs" resultType="com.jair.entity.vo.PlanningOperationLogVo">
SELECT
l.*, p.name AS planName, p.plan_date, p.payable_amount, v.plate_no, v.brand_name, v.model, d.name AS driverName, d.phone AS driverPhone, d.identity_id AS driverId
FROM planning_operation_log l
JOIN fee_planning p ON l.planning_id = p.id
JOIN contract c ON l.contract_id = c.id
JOIN driver d ON c.driver_id = d.id
JOIN vehicle v ON c.vehicle_id = v.id
WHERE
p.contract_type = #{searcher.contractType}
<if test="searcher.companyId != null">
AND l.company_id = #{searcher.companyId}
</if>
<if test="searcher.operationType != null">
AND l.type = #{searcher.operationType}
</if>
<if test="searcher.planDateStart != null">
<![CDATA[ AND p.plan_date >= #{searcher.planDateStart} ]]>
</if>
<if test="searcher.planDateEnd != null">
<![CDATA[ AND p.plan_date <= #{searcher.planDateEnd} ]]>
</if>
<if test="searcher.createDateStart != null">
<![CDATA[ AND l.create_time >= #{searcher.createDateStart} ]]>
</if>
<if test="searcher.createDateEnd != null">
<![CDATA[ AND l.create_time <= #{searcher.createDateEnd} ]]>
</if>
<if test="searcher.driverInfo != null and searcher.driverInfo != ''">
AND (d.name LIKE CONCAT('%', #{searcher.driverInfo}, '%') OR d.phone LIKE CONCAT('%', #{searcher.driverInfo}, '%') OR d.identity_number LIKE CONCAT('%', #{searcher.driverInfo}, '%'))
</if>
<if test="searcher.vehicleInfo != null and searcher.vehicleInfo != ''">
AND (v.plate_no LIKE CONCAT('%', #{searcher.vehicleInfo}, '%') OR v.model LIKE CONCAT('%', #{searcher.vehicleInfo}, '%'))
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.SequenceMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.SourceMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.VehicleLicenseMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jair.mapper.VehicleMapper">
<select id="listNoSourceContractVehicles" resultType="com.jair.entity.vo.VehicleVo">
SELECT * FROM vehicle WHERE company_id = #{companyId} AND id NOT IN (
SELECT vehicle_id FROM contract WHERE `type`=1 AND company_id = #{companyId} AND status = 1)
</select>
<select id="listAllowRentVehicles" resultType="com.jair.entity.vo.VehicleVo">
SELECT * FROM vehicle WHERE company_id = #{companyId}
AND id IN (SELECT vehicle_id FROM contract WHERE `type`=1 AND company_id = #{companyId} AND status = 1)
AND id NOT IN (SELECT vehicle_id FROM contract WHERE `type`=2 AND company_id = #{companyId} AND status = 1)
</select>
</mapper>
package com.jair;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.CreateAccountPo;
import com.jair.entity.po.LoginPo;
import com.jair.service.IAccountService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class AccountTest {
@Autowired
private IAccountService accountService;
@Test
public void login() {
LoginPo loginPo = new LoginPo();
loginPo.setUsername("test");
loginPo.setPassword("965EB72C92A549DD");
}
@Test
public void create() {
CreateAccountPo createAccountPo = new CreateAccountPo();
createAccountPo.setUsername("mbox2001");
createAccountPo.setPassword("123456");
createAccountPo.setRealName("Jair");
createAccountPo.setPhone("13601361331");
createAccountPo.setAddress("北京");
createAccountPo.setType(AccountTypeEnum.SUB.getKey());
createAccountPo.setCompanyId(1);
System.out.println(accountService.createAccount(getTokenInfo(), createAccountPo));
}
public TokenInfo getTokenInfo() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setType(AccountTypeEnum.ADMIN.getKey());
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
tokenInfo.setCompanyName("测试公司");
return tokenInfo;
}
}
package com.jair;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.constant.AccountTypeEnum;
import com.jair.entity.po.CreateAccountPo;
import com.jair.entity.po.LoginPo;
import com.jair.service.IAccountService;
import com.jair.service.impl.AnalyticsServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.ParseException;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class AnalyticsTest {
@Autowired
private AnalyticsServiceImpl analyticsService;
@Test
public void dashboardTest() throws ParseException {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setType(AccountTypeEnum.ADMIN.getKey());
System.out.println(analyticsService.dashboard(tokenInfo));
}
}
package com.jair;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
public class CodeGenerator {
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("Jair");
gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/jair?useUnicode=true&useSSL=false&characterEncoding=utf8");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("12345678");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
// pc.setModuleName(scanner("模块名"));
pc.setParent("com.jair");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
// String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
/*
cfg.setFileCreate(new IFileCreate() {
@Override
public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
// 判断自定义文件夹是否需要创建
checkDir("调用默认方法创建的目录");
return false;
}
});
*/
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(false);
// 公共父类
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
strategy.setSuperEntityColumns("id");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
\ No newline at end of file
package com.jair;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CompanyPo;
import com.jair.service.ICompanyService;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class CompanyTest {
@Autowired
private ICompanyService companyService;
@Test
public void createCompany() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(1);
tokenInfo.setRealName("1111");
CompanyPo company = new CompanyPo();
company.setName("在在在1");
company.setAbbr("zzzz");
company.setContactName("张三");
company.setContactPhone("123123123123");
company.setExpiredDate(DateUtil.getAddDayTime(30));
System.out.println(companyService.createCompany(tokenInfo, company));
}
@Test
public void updateCompany() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(1);
tokenInfo.setRealName("1111");
CompanyPo company = new CompanyPo();
company.setId(1);
company.setName("测试公司1");
company.setAbbr("zzzz");
company.setContactName("张三");
company.setContactPhone("123123123123");
company.setExpiredDate(DateUtil.getAddDayTime(30));
System.out.println(companyService.updateCompany(tokenInfo, company));
}
@Test
public void list() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setType(0);
tokenInfo.setId(1);
tokenInfo.setRealName("1111");
System.out.println(companyService.listCompanys(tokenInfo, null));
}
@Test
public void checkExpiredCompanys() {
companyService.checkExpiredCompanys();
}
}
package com.jair;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jair.entity.bo.Contract;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.*;
import com.jair.mapper.ContractMapper;
import com.jair.mapper.FeePlanningMapper;
import com.jair.service.IContractService;
import com.jair.service.impl.PlanningServiceImpl;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Calendar;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class ContractTest {
@Autowired
private IContractService sourceContractService;
@Autowired
ContractMapper contractMapper;
@Autowired
FeePlanningMapper planningMapper;
@Test
public void createCode() {
for (int i = 0; i < 100; i++) {
int type = i % 2;
if (type == 0) {
type = 2;
}
System.out.println(sourceContractService.genContractCode(type));
}
}
@Test
public void queryContract() {
Page<Contract> page = new Page<>(2, 1);
SearchContractPo se = new SearchContractPo();
se.setType(2);
System.out.println(contractMapper.queryDriverContracts(page, se));
}
@Test
public void sourceSignContracts() throws Exception {
SignContractPo signSourceContractPo = new SignContractPo();
signSourceContractPo.setVehicleId(2);
signSourceContractPo.setSourceId(1);
signSourceContractPo.setStartDate(DateUtil.getAddDayTime(0));
signSourceContractPo.setEndDate(DateUtil.getAddDayTime(180));
signSourceContractPo.setOdograph(10000);
signSourceContractPo.setOdographEv(200);
signSourceContractPo.setRentAmount(3700);
System.out.println(sourceContractService.signContract(getTokenInfo(), signSourceContractPo));
}
@Test
public void saveRentPlanning() throws ParseException {
Contract contract = new Contract();
contract.setId(1);
contract.setStartDate(DateUtil.parseDate("2020-01-01"));
contract.setEndDate(DateUtil.getAddTime(DateUtil.parseDate("2020-01-01"), Calendar.DATE, 90));
contract.setLeaseType(1);
contract.setRentAmount(3000);
}
@Test
public void updateContracts() {
UpdateContractPo updateContractPo = new UpdateContractPo();
updateContractPo.setContractId(2);
updateContractPo.setStartDate(DateUtil.getAddDayTime(30));
updateContractPo.setEndDate(DateUtil.getAddDayTime(80));
updateContractPo.setOdograph(10000);
updateContractPo.setOdographEv(0);
updateContractPo.setDepositStatus(2);
updateContractPo.setReturnDepositAmount(500);
updateContractPo.setRentAmount(9000);
System.out.println(sourceContractService.updateContract(getTokenInfo(), updateContractPo));
}
@Test
public void returnVehicle() {
ReturnVehiclePo returnVehiclePo = new ReturnVehiclePo();
returnVehiclePo.setContractId(2);
returnVehiclePo.setAccident(1);
returnVehiclePo.setAccidentFiles(Arrays.asList(111, 222));
returnVehiclePo.setLicense(0);
returnVehiclePo.setBreakRulesAmount(500);
returnVehiclePo.setBreakRulesDeduction(3);
System.out.println(sourceContractService.returnVehicle(getTokenInfo(), returnVehiclePo));
}
@Test
public void sourceReturnDeposit() {
ReturnDepositPo returnDepositPo = new ReturnDepositPo();
returnDepositPo.setContractId(1);
returnDepositPo.setReturnAmount(1000);
returnDepositPo.setRemark("退1000");
System.out.println(sourceContractService.returnDeposit(getTokenInfo(), returnDepositPo));
}
@Test
public void sourceTerminateContracts() {
TerminateContractPo terminatePo = new TerminateContractPo();
terminatePo.setContractId(1);
System.out.println(sourceContractService.terminateContract(getTokenInfo(), terminatePo));
}
@Test
public void list() {
SearchPlanningPo searchPlanningPo = new SearchPlanningPo();
}
public TokenInfo getTokenInfo() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
return tokenInfo;
}
}
package com.jair;
import com.jair.entity.common.TokenInfo;
import com.jair.service.IDataService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class DataTest {
@Autowired
private IDataService dataService;
@Test
public void list() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setCompanyId(1);
System.out.println(dataService.listEnvironmentalStandards(tokenInfo));
System.out.println(dataService.listUseCharacters(tokenInfo));
System.out.println(dataService.listColors(tokenInfo));
System.out.println(dataService.listEngineTypes(tokenInfo));
System.out.println(dataService.listVehicleTypes(tokenInfo));
System.out.println(dataService.listBrands(tokenInfo));
}
}
package com.jair;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.DriverPo;
import com.jair.entity.po.SearchDriverPo;
import com.jair.service.IDriverService;
import com.jair.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class DriverTest {
@Autowired
private IDriverService driverService;
@Test
public void createDriver() throws Exception {
DriverPo driverPo = new DriverPo();
driverPo.setName("魏吉光");
driverPo.setGender("男");
driverPo.setIdentityNumber("239005831040071");
driverPo.setPhone("13601361337");
driverPo.setAddress("北京市通州区");
driverPo.setContactName("sea");
driverPo.setContactPhone("15901410478");
driverPo.setServiceLicense(1);
driverPo.setIdentityValidPeriodStart(DateUtil.parseDate("2018-10-1"));
driverPo.setIdentityValidPeriodEnd(DateUtil.parseDate("2038-9-30"));
driverPo.setFrontFileId(1);
driverPo.setBackFileId(2);
driverPo.setCredentialNo("111111");
driverPo.setFileNo("No.10000");
driverPo.setFirstIssue(DateUtil.parseDate("2010-11-11"));
driverPo.setDrivingClass("A2");
driverPo.setLicenseValidPeriodStart(DateUtil.parseDate("2019-1-1"));
driverPo.setLicenseValidPeriodEnd(DateUtil.parseDate("2025-5-3"));
driverPo.setMainFileId(3);
driverPo.setSecondFileId(4);
System.out.println(driverService.createDriver(getTokenInfo(), driverPo));
}
@Test
public void updateDriver() throws Exception {
DriverPo driverPo = new DriverPo();
driverPo.setId(4);
driverPo.setName("魏吉光1");
driverPo.setGender("男");
driverPo.setIdentityNumber("239005831030071");
driverPo.setPhone("13601361337");
driverPo.setAddress("北京市通州区");
driverPo.setContactName("sea");
driverPo.setContactPhone("15901410478");
driverPo.setServiceLicense(1);
driverPo.setIdentityValidPeriodStart(DateUtil.parseDate("2018-10-1"));
driverPo.setIdentityValidPeriodEnd(DateUtil.parseDate("2038-9-30"));
driverPo.setFrontFileId(11);
driverPo.setBackFileId(22);
driverPo.setCredentialNo("111111");
driverPo.setFileNo("No.10000");
driverPo.setFirstIssue(DateUtil.parseDate("2010-11-11"));
driverPo.setDrivingClass("A2");
driverPo.setLicenseValidPeriodStart(DateUtil.parseDate("2019-1-1"));
driverPo.setLicenseValidPeriodEnd(DateUtil.parseDate("2025-5-3"));
driverPo.setMainFileId(33);
driverPo.setSecondFileId(44);
System.out.println(driverService.updateDriver(getTokenInfo(), driverPo));
}
@Test
public void list() {
PageInfo<SearchDriverPo> pageInfo = new PageInfo<>();
SearchDriverPo searchPo = new SearchDriverPo();
searchPo.setName("1");
pageInfo.setRecords(searchPo);
System.out.println(driverService.listDrivers(getTokenInfo(), pageInfo));
}
public TokenInfo getTokenInfo() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
return tokenInfo;
}
}
package com.jair;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.SourcePo;
import com.jair.service.ISourceService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class SourceTest {
@Autowired
private ISourceService sourceService;
@Test
public void createSource() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
SourcePo sourcePo = new SourcePo();
sourcePo.setName("神州租车");
sourcePo.setContactName("王二麻了");
sourcePo.setContactPhone("13599990000");
sourcePo.setAddress("北京市海淀区中关村大街");
System.out.println(sourceService.createSource(tokenInfo, sourcePo));
}
@Test
public void list() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(2);
}
}
package com.jair;
import com.jair.util.DateUtil;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
public class Test {
public static void main(String[] args) throws ParseException {
String d = "2020-10-10";
Date date = DateUtil.parseDate(d);
Date d1 = DateUtil.getAddTime(date, Calendar.DATE, 365);
System.out.println(DateUtil.format2Date(d1));
}
}
package com.jair;
import com.jair.service.IAttFileService;
import com.jair.util.BaiduAI;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.File;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class UploadTest {
@Autowired
IAttFileService attFileService;
@Autowired
BaiduAI baiduAI;
@Test
public void uploadTest() throws Exception {
}
@Test
public void detectIDCard() throws Exception {
String filePath1 = "/Users/jair/Documents/证件/居住证/872446035838462286.jpg";
System.out.println(baiduAI.identityCardDetect(new File(filePath1), true));
String filePath2 = "/Users/jair/Documents/证件/居住证/885916278838050824.jpg";
System.out.println(baiduAI.identityCardDetect(new File(filePath2), false));
}
@Test
public void detectDriver() throws Exception {
String filePath1 = "/Users/jair/Downloads/2761601624681_pic.jpg";
System.out.println(baiduAI.drivingLicenseDetect(new File(filePath1)));
}
}
package com.jair;
import com.jair.entity.common.PageInfo;
import com.jair.entity.common.TokenInfo;
import com.jair.entity.po.CreateVehiclePo;
import com.jair.entity.po.SearchVechiclePo;
import com.jair.service.IVehicleService;
import com.jair.util.BaiduAI;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.File;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class VehicleTest {
@Autowired
private IVehicleService vehicleService;
@Autowired
private BaiduAI baiduAI;
@Test
public void testVehicleLicenseDetect() throws Exception {
// File file1 = new File("/Users/jair/Downloads/测试图片/行驶证_主页.png");
// System.out.println(baiduAI.vehicleLicenseDetect(file1, true));
//
// File file2 = new File("/Users/jair/Downloads/测试图片/行驶证_副页.png");
// System.out.println(baiduAI.vehicleLicenseDetect(file2, false));
System.out.println(baiduAI.vehicleLicenseDetect("https://sskx-fs-dev-1259667406.cos.ap-beijing.myqcloud.com/files/202009/sskx_5863d9b06d231f20e38090c5115ea6c3_E8A18CE9A9B6E8AF81_E4B8BBE9A1B5.png", false));
}
@Test
public void createVehicle() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
CreateVehiclePo vehiclePo = new CreateVehiclePo();
vehiclePo.setBrandName("大众");
vehiclePo.setModel("朗逸");
vehiclePo.setDisplacement("1.5T");
vehiclePo.setColor("黑色");
vehiclePo.setEnvironmentalStandards("国I");
vehiclePo.setEngineType("汽油");
vehiclePo.setPlateNo("京JFF877");
System.out.println(vehicleService.createVehicle(tokenInfo, vehiclePo));
}
@Test
public void returnVehicle() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
System.out.println(vehicleService.returnVehicle(tokenInfo, 2));
}
@Test
public void list() {
TokenInfo tokenInfo = new TokenInfo();
tokenInfo.setId(2);
tokenInfo.setRealName("张三");
tokenInfo.setCompanyId(1);
PageInfo<SearchVechiclePo> pageInfo = new PageInfo<>();
SearchVechiclePo searchPo = new SearchVechiclePo();
// searchPo.setBrandName("宝马");
pageInfo.setRecords(searchPo);
System.out.println(vehicleService.listVehicles(tokenInfo, pageInfo));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.58" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.8.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.16" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.23" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.9" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.9" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.21" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.21" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.21" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.17.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.1.5" level="project" />
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.14" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.14" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.2" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
</component>
</module>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment