1、调整币种汇率模块
2、新增保险记录模块 3、新增违章记录模块 4、新增换胎记录模块 5、新增事故记录模块 6、新增年检记录模块 7、新增里程记录模块 8、新增变更记录模块 9、新增油电记录模块 10、新增ETC记录模块 11、新增其他费用记录模块
This commit is contained in:
@@ -31,6 +31,10 @@
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-transport-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-user-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.AccidentRecordExcel;
|
||||
import org.springblade.transport.excel.AccidentRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.AccidentRecord;
|
||||
import org.springblade.transport.pojo.vo.AccidentRecordVO;
|
||||
import org.springblade.transport.service.IAccidentRecordService;
|
||||
import org.springblade.transport.wrapper.AccidentRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "accident_record")
|
||||
@RequestMapping("/accident-record")
|
||||
@Tag(name = "事故记录", description = "事故记录")
|
||||
public class AccidentRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IAccidentRecordService accidentRecordService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入accidentRecord")
|
||||
public R<AccidentRecordVO> detail(AccidentRecord accidentRecord) {
|
||||
AccidentRecord detail = accidentRecordService.getOne(Condition.getQueryWrapper(accidentRecord));
|
||||
return R.data(AccidentRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入accidentRecord")
|
||||
public R<IPage<AccidentRecordVO>> list(AccidentRecordVO accidentRecord, Query query) {
|
||||
IPage<AccidentRecordVO> pages = accidentRecordService.selectAccidentRecordPage(Condition.getPage(normalizeQuery(query)), accidentRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入accidentRecord")
|
||||
public R submit(@Valid @RequestBody AccidentRecord accidentRecord) {
|
||||
return R.status(accidentRecordService.submit(accidentRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(accidentRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入事故记录
|
||||
*/
|
||||
@PostMapping("/import-accident-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入事故记录", description = "传入excel")
|
||||
public R importAccidentRecord(MultipartFile file) {
|
||||
AccidentRecordImporter accidentRecordImporter = new AccidentRecordImporter(accidentRecordService);
|
||||
ExcelUtil.save(file, accidentRecordImporter, AccidentRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出事故记录
|
||||
*/
|
||||
@GetMapping("/export-accident-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出事故记录")
|
||||
public void exportAccidentRecord(AccidentRecordVO accidentRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<AccidentRecordExcel> list = accidentRecordService.exportAccidentRecord(buildExportQuery(accidentRecord, ids));
|
||||
ExcelUtil.export(response, "事故记录" + DateUtil.time(), "事故记录表", list, AccidentRecordExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<AccidentRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "事故记录模板", "事故记录表", list, AccidentRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AccidentRecord> buildExportQuery(AccidentRecordVO accidentRecord, String ids) {
|
||||
LambdaQueryWrapper<AccidentRecord> queryWrapper = Wrappers.<AccidentRecord>lambdaQuery()
|
||||
.eq(AccidentRecord::getIsDeleted, 0)
|
||||
.orderByDesc(AccidentRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(AccidentRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getCreateDept())) {
|
||||
queryWrapper.eq(AccidentRecord::getCreateDept, accidentRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getVehicleType())) {
|
||||
queryWrapper.eq(AccidentRecord::getVehicleType, accidentRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getVehicleNo())) {
|
||||
queryWrapper.like(AccidentRecord::getVehicleNo, accidentRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getAccidentNature())) {
|
||||
queryWrapper.eq(AccidentRecord::getAccidentNature, accidentRecord.getAccidentNature());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getAccidentResponsibility())) {
|
||||
queryWrapper.eq(AccidentRecord::getAccidentResponsibility, accidentRecord.getAccidentResponsibility());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getAccidentReasonDamage())) {
|
||||
queryWrapper.like(AccidentRecord::getAccidentReasonDamage, accidentRecord.getAccidentReasonDamage());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getAccidentAssessmentDateStart())) {
|
||||
queryWrapper.ge(AccidentRecord::getAccidentDate, accidentRecord.getAccidentAssessmentDateStart());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getAccidentAssessmentDateEnd())) {
|
||||
queryWrapper.le(AccidentRecord::getAccidentDate, accidentRecord.getAccidentAssessmentDateEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(AccidentRecord::getCreateTime, accidentRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(accidentRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(AccidentRecord::getCreateTime, accidentRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
|
||||
import org.springblade.transport.excel.AnnualInspectionRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
|
||||
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
|
||||
import org.springblade.transport.service.IAnnualInspectionRecordService;
|
||||
import org.springblade.transport.wrapper.AnnualInspectionRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 年检记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "annual_inspection_record")
|
||||
@RequestMapping("/annual-inspection-record")
|
||||
@Tag(name = "年检记录", description = "年检记录")
|
||||
public class AnnualInspectionRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IAnnualInspectionRecordService annualInspectionRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入annualInspectionRecord")
|
||||
public R<AnnualInspectionRecordVO> detail(AnnualInspectionRecord annualInspectionRecord) {
|
||||
AnnualInspectionRecord detail = annualInspectionRecordService.getOne(Condition.getQueryWrapper(annualInspectionRecord));
|
||||
return R.data(AnnualInspectionRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入annualInspectionRecord")
|
||||
public R<IPage<AnnualInspectionRecordVO>> list(AnnualInspectionRecordVO annualInspectionRecord, Query query) {
|
||||
IPage<AnnualInspectionRecordVO> pages = annualInspectionRecordService.selectAnnualInspectionRecordPage(Condition.getPage(normalizeQuery(query)), annualInspectionRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入annualInspectionRecord")
|
||||
public R submit(@Valid @RequestBody AnnualInspectionRecord annualInspectionRecord) {
|
||||
return R.status(annualInspectionRecordService.submit(annualInspectionRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(annualInspectionRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-annual-inspection-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入年检记录", description = "传入excel")
|
||||
public R importAnnualInspectionRecord(MultipartFile file) {
|
||||
AnnualInspectionRecordImporter annualInspectionRecordImporter = new AnnualInspectionRecordImporter(annualInspectionRecordService);
|
||||
ExcelUtil.save(file, annualInspectionRecordImporter, AnnualInspectionRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-annual-inspection-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出年检记录")
|
||||
public void exportAnnualInspectionRecord(AnnualInspectionRecordVO annualInspectionRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<AnnualInspectionRecordExcel> list = annualInspectionRecordService.exportAnnualInspectionRecord(buildExportQuery(annualInspectionRecord, ids));
|
||||
ExcelUtil.export(response, "年检记录" + DateUtil.time(), "年检记录表", list, AnnualInspectionRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<AnnualInspectionRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "年检记录模板", "年检记录表", list, AnnualInspectionRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AnnualInspectionRecord> buildExportQuery(AnnualInspectionRecordVO annualInspectionRecord, String ids) {
|
||||
LambdaQueryWrapper<AnnualInspectionRecord> queryWrapper = Wrappers.<AnnualInspectionRecord>lambdaQuery()
|
||||
.eq(AnnualInspectionRecord::getIsDeleted, 0)
|
||||
.orderByDesc(AnnualInspectionRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(AnnualInspectionRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getCreateDept())) {
|
||||
queryWrapper.eq(AnnualInspectionRecord::getCreateDept, annualInspectionRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getVehicleType())) {
|
||||
queryWrapper.eq(AnnualInspectionRecord::getVehicleType, annualInspectionRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getVehicleNo())) {
|
||||
queryWrapper.like(AnnualInspectionRecord::getVehicleNo, annualInspectionRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getInspectionAssessmentDateStart())) {
|
||||
queryWrapper.ge(AnnualInspectionRecord::getInspectionAssessmentDate, annualInspectionRecord.getInspectionAssessmentDateStart());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getInspectionAssessmentDateEnd())) {
|
||||
queryWrapper.le(AnnualInspectionRecord::getInspectionAssessmentDate, annualInspectionRecord.getInspectionAssessmentDateEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(AnnualInspectionRecord::getCreateTime, annualInspectionRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(annualInspectionRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(AnnualInspectionRecord::getCreateTime, annualInspectionRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.CustomerArchiveExcel;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerCreditScoreVO;
|
||||
import org.springblade.transport.service.ICustomerArchiveService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客商档案 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "customer_archive")
|
||||
@RequestMapping("/customer-archive")
|
||||
@Tag(name = "客商档案", description = "客商档案")
|
||||
public class CustomerArchiveController extends BladeController {
|
||||
|
||||
private final ICustomerArchiveService customerArchiveService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入id")
|
||||
public R<CustomerArchiveVO> detail(@Parameter(description = "主键", required = true) @RequestParam Long id) {
|
||||
return R.data(customerArchiveService.detail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入customerArchive")
|
||||
public R<IPage<CustomerArchiveVO>> list(CustomerArchiveVO customerArchive, Query query) {
|
||||
IPage<CustomerArchiveVO> pages = customerArchiveService.selectCustomerArchivePage(Condition.getPage(query), customerArchive);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入customerArchive")
|
||||
public R submit(@RequestBody CustomerArchiveVO customerArchive) {
|
||||
return R.status(customerArchiveService.submit(customerArchive));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审核
|
||||
*/
|
||||
@PostMapping("/submit-approval")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "提交审核", description = "传入id")
|
||||
public R submitApproval(@Parameter(description = "主键", required = true) @RequestParam Long id) {
|
||||
return R.status(customerArchiveService.submitApproval(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核通过
|
||||
*/
|
||||
@PostMapping("/approve")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "审核通过", description = "传入id")
|
||||
public R approve(@Parameter(description = "主键", required = true) @RequestParam Long id) {
|
||||
return R.status(customerArchiveService.approve(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核不通过
|
||||
*/
|
||||
@PostMapping("/reject")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "审核不通过", description = "传入id")
|
||||
public R reject(@Parameter(description = "主键", required = true) @RequestParam Long id) {
|
||||
return R.status(customerArchiveService.reject(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或停用
|
||||
*/
|
||||
@PostMapping("/status")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "启用或停用", description = "传入id和status")
|
||||
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
|
||||
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
|
||||
return R.status(customerArchiveService.changeStatus(id, status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(customerArchiveService.removeDraft(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 评分明细模板
|
||||
*/
|
||||
@GetMapping("/score-template")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "评分明细模板", description = "传入评分量化表ID")
|
||||
public R<CustomerCreditScoreVO> scoreTemplate(@RequestParam(required = false) Long quantificationId) {
|
||||
return R.data(customerArchiveService.buildScoreTemplate(quantificationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出客商档案
|
||||
*/
|
||||
@GetMapping("/export-customer-archive")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "导出客商档案")
|
||||
public void exportCustomerArchive(CustomerArchiveVO customerArchive,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<CustomerArchiveExcel> list = customerArchiveService.exportCustomerArchive(buildExportQuery(customerArchive, ids));
|
||||
ExcelUtil.export(response, "客商档案" + DateUtil.time(), "客商档案", list, CustomerArchiveExcel.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CustomerArchive> buildExportQuery(CustomerArchiveVO customerArchive, String ids) {
|
||||
LambdaQueryWrapper<CustomerArchive> queryWrapper = Wrappers.<CustomerArchive>lambdaQuery()
|
||||
.eq(CustomerArchive::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerArchive::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(CustomerArchive::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getCustomerCode())) {
|
||||
queryWrapper.like(CustomerArchive::getCustomerCode, customerArchive.getCustomerCode());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getFullName())) {
|
||||
queryWrapper.like(CustomerArchive::getFullName, customerArchive.getFullName());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getShortName())) {
|
||||
queryWrapper.like(CustomerArchive::getShortName, customerArchive.getShortName());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getUnifiedCreditCode())) {
|
||||
queryWrapper.like(CustomerArchive::getUnifiedCreditCode, customerArchive.getUnifiedCreditCode());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getCustomerNature())) {
|
||||
queryWrapper.eq(CustomerArchive::getCustomerNature, customerArchive.getCustomerNature());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getCustomerType())) {
|
||||
queryWrapper.like(CustomerArchive::getCustomerType, customerArchive.getCustomerType());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getAccessType())) {
|
||||
queryWrapper.eq(CustomerArchive::getAccessType, customerArchive.getAccessType());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getApprovalStatus())) {
|
||||
queryWrapper.eq(CustomerArchive::getApprovalStatus, customerArchive.getApprovalStatus());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getStatus())) {
|
||||
queryWrapper.eq(CustomerArchive::getStatus, customerArchive.getStatus());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getDeptName())) {
|
||||
queryWrapper.like(CustomerArchive::getDeptName, customerArchive.getDeptName());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getCreateTimeStart())) {
|
||||
queryWrapper.ge(CustomerArchive::getCreateTime, customerArchive.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(customerArchive.getCreateTimeEnd())) {
|
||||
queryWrapper.le(CustomerArchive::getCreateTime, customerArchive.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.DriverExcel;
|
||||
import org.springblade.transport.pojo.entity.Driver;
|
||||
import org.springblade.transport.pojo.vo.DriverExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.DriverVO;
|
||||
import org.springblade.transport.service.IDriverService;
|
||||
import org.springblade.transport.wrapper.DriverWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机管理 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "driver")
|
||||
@RequestMapping("/driver")
|
||||
@Tag(name = "司机管理", description = "司机管理")
|
||||
public class DriverController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IDriverService driverService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入driver")
|
||||
public R<DriverVO> detail(Driver driver) {
|
||||
Driver detail = driverService.getOne(Condition.getQueryWrapper(driver));
|
||||
return R.data(DriverWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入driver")
|
||||
public R<IPage<DriverVO>> list(DriverVO driver, Query query) {
|
||||
fillExpiryDate(driver);
|
||||
IPage<DriverVO> pages = driverService.selectDriverPage(Condition.getPage(normalizeQuery(query)), driver);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入driver")
|
||||
public R submit(@Valid @RequestBody Driver driver) {
|
||||
return R.status(driverService.submit(driver));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(driverService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
@PostMapping("/status")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改状态")
|
||||
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
|
||||
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
|
||||
return R.status(driverService.changeStatus(id, status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*/
|
||||
@GetMapping("/expiry-stat")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "证件有效期统计", description = "传入driver")
|
||||
public R<DriverExpiryStatVO> expiryStat(DriverVO driver) {
|
||||
fillExpiryDate(driver);
|
||||
return R.data(driverService.expiryStat(driver));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出司机
|
||||
*/
|
||||
@GetMapping("/export-driver")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出司机")
|
||||
public void exportDriver(DriverVO driver,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
fillExpiryDate(driver);
|
||||
List<DriverExcel> list = driverService.exportDriver(buildExportQuery(driver, ids));
|
||||
ExcelUtil.export(response, "司机管理" + DateUtil.time(), "司机管理表", list, DriverExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<DriverExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "司机管理模板", "司机管理表", list, DriverExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private void fillExpiryDate(DriverVO driver) {
|
||||
if (driver.getToday() == null) {
|
||||
driver.setToday(LocalDate.now());
|
||||
}
|
||||
if (driver.getWarningDate() == null) {
|
||||
driver.setWarningDate(driver.getToday().plusDays(30));
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Driver> buildExportQuery(DriverVO driver, String ids) {
|
||||
LambdaQueryWrapper<Driver> queryWrapper = Wrappers.<Driver>lambdaQuery()
|
||||
.eq(Driver::getIsDeleted, 0)
|
||||
.orderByDesc(Driver::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(Driver::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getDriverName())) {
|
||||
queryWrapper.like(Driver::getDriverName, driver.getDriverName());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getMobile())) {
|
||||
queryWrapper.like(Driver::getMobile, driver.getMobile());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getIdCardNo())) {
|
||||
queryWrapper.like(Driver::getIdCardNo, driver.getIdCardNo());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getDrivingType())) {
|
||||
queryWrapper.eq(Driver::getDrivingType, driver.getDrivingType());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getDriverType())) {
|
||||
queryWrapper.eq(Driver::getDriverType, driver.getDriverType());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getOrganizationName())) {
|
||||
queryWrapper.like(Driver::getOrganizationName, driver.getOrganizationName());
|
||||
}
|
||||
if (Func.isNotEmpty(driver.getStatus())) {
|
||||
queryWrapper.eq(Driver::getStatus, driver.getStatus());
|
||||
}
|
||||
if ("within30".equals(driver.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(Driver::getDrivingLicenseLongTerm, 1)
|
||||
.between(Driver::getDrivingLicenseEndDate, driver.getToday(), driver.getWarningDate()))
|
||||
.or(item -> item.ne(Driver::getQualificationLongTerm, 1)
|
||||
.between(Driver::getQualificationEndDate, driver.getToday(), driver.getWarningDate())));
|
||||
}
|
||||
if ("expired".equals(driver.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(Driver::getDrivingLicenseLongTerm, 1)
|
||||
.lt(Driver::getDrivingLicenseEndDate, driver.getToday()))
|
||||
.or(item -> item.ne(Driver::getQualificationLongTerm, 1)
|
||||
.lt(Driver::getQualificationEndDate, driver.getToday())));
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.EtcRecordExcel;
|
||||
import org.springblade.transport.excel.EtcRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.EtcRecord;
|
||||
import org.springblade.transport.pojo.vo.EtcRecordVO;
|
||||
import org.springblade.transport.service.IEtcRecordService;
|
||||
import org.springblade.transport.wrapper.EtcRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ETC记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "etc_record")
|
||||
@RequestMapping("/etc-record")
|
||||
@Tag(name = "ETC记录", description = "ETC记录")
|
||||
public class EtcRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IEtcRecordService etcRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入etcRecord")
|
||||
public R<EtcRecordVO> detail(EtcRecord etcRecord) {
|
||||
EtcRecord detail = etcRecordService.getOne(Condition.getQueryWrapper(etcRecord));
|
||||
return R.data(EtcRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入etcRecord")
|
||||
public R<IPage<EtcRecordVO>> list(EtcRecordVO etcRecord, Query query) {
|
||||
IPage<EtcRecordVO> pages = etcRecordService.selectEtcRecordPage(Condition.getPage(normalizeQuery(query)), etcRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入etcRecord")
|
||||
public R submit(@Valid @RequestBody EtcRecord etcRecord) {
|
||||
return R.status(etcRecordService.submit(etcRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(etcRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-etc-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入ETC记录", description = "传入excel")
|
||||
public R importEtcRecord(MultipartFile file) {
|
||||
EtcRecordImporter etcRecordImporter = new EtcRecordImporter(etcRecordService);
|
||||
ExcelUtil.save(file, etcRecordImporter, EtcRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-etc-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出ETC记录")
|
||||
public void exportEtcRecord(EtcRecordVO etcRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<EtcRecordExcel> list = etcRecordService.exportEtcRecord(buildExportQuery(etcRecord, ids));
|
||||
ExcelUtil.export(response, "ETC记录" + DateUtil.time(), "ETC记录表", list, EtcRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<EtcRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "ETC记录模板", "ETC记录表", list, EtcRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EtcRecord> buildExportQuery(EtcRecordVO etcRecord, String ids) {
|
||||
LambdaQueryWrapper<EtcRecord> queryWrapper = Wrappers.<EtcRecord>lambdaQuery()
|
||||
.eq(EtcRecord::getIsDeleted, 0)
|
||||
.orderByDesc(EtcRecord::getExitTime)
|
||||
.orderByDesc(EtcRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(EtcRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(etcRecord.getCreateDept())) {
|
||||
queryWrapper.eq(EtcRecord::getCreateDept, etcRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(etcRecord.getVehicleNo())) {
|
||||
queryWrapper.like(EtcRecord::getVehicleNo, etcRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(etcRecord.getEtcCardNo())) {
|
||||
queryWrapper.like(EtcRecord::getEtcCardNo, etcRecord.getEtcCardNo());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.InsuranceRecordExcel;
|
||||
import org.springblade.transport.excel.InsuranceRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.InsuranceRecord;
|
||||
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
|
||||
import org.springblade.transport.service.IInsuranceRecordService;
|
||||
import org.springblade.transport.wrapper.InsuranceRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保险记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "insurance_record")
|
||||
@RequestMapping("/insurance-record")
|
||||
@Tag(name = "保险记录", description = "保险记录")
|
||||
public class InsuranceRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IInsuranceRecordService insuranceRecordService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入insuranceRecord")
|
||||
public R<InsuranceRecordVO> detail(InsuranceRecord insuranceRecord) {
|
||||
InsuranceRecord detail = insuranceRecordService.getOne(Condition.getQueryWrapper(insuranceRecord));
|
||||
return R.data(InsuranceRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入insuranceRecord")
|
||||
public R<IPage<InsuranceRecordVO>> list(InsuranceRecordVO insuranceRecord, Query query) {
|
||||
IPage<InsuranceRecordVO> pages = insuranceRecordService.selectInsuranceRecordPage(Condition.getPage(normalizeQuery(query)), insuranceRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入insuranceRecord")
|
||||
public R submit(@Valid @RequestBody InsuranceRecord insuranceRecord) {
|
||||
return R.status(insuranceRecordService.submit(insuranceRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(insuranceRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入保险记录
|
||||
*/
|
||||
@PostMapping("/import-insurance-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入保险记录", description = "传入excel")
|
||||
public R importInsuranceRecord(MultipartFile file) {
|
||||
InsuranceRecordImporter insuranceRecordImporter = new InsuranceRecordImporter(insuranceRecordService);
|
||||
ExcelUtil.save(file, insuranceRecordImporter, InsuranceRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出保险记录
|
||||
*/
|
||||
@GetMapping("/export-insurance-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出保险记录")
|
||||
public void exportInsuranceRecord(InsuranceRecordVO insuranceRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<InsuranceRecordExcel> list = insuranceRecordService.exportInsuranceRecord(buildExportQuery(insuranceRecord, ids));
|
||||
ExcelUtil.export(response, "保险记录" + DateUtil.time(), "保险记录表", list, InsuranceRecordExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<InsuranceRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "保险记录模板", "保险记录表", list, InsuranceRecordExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* OCR识别保单
|
||||
*/
|
||||
@PostMapping("/recognize")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "OCR识别保单", description = "上传保单图片或PDF")
|
||||
public R<InsuranceRecord> recognize(MultipartFile file,
|
||||
@RequestParam(required = false) String vehicleType,
|
||||
@RequestParam(required = false) String ocrTemplate) {
|
||||
try {
|
||||
return R.data(insuranceRecordService.recognizePolicy(file, vehicleType, ocrTemplate));
|
||||
} catch (ServiceException exception) {
|
||||
return R.fail(exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<InsuranceRecord> buildExportQuery(InsuranceRecordVO insuranceRecord, String ids) {
|
||||
LambdaQueryWrapper<InsuranceRecord> queryWrapper = Wrappers.<InsuranceRecord>lambdaQuery()
|
||||
.eq(InsuranceRecord::getIsDeleted, 0)
|
||||
.orderByDesc(InsuranceRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(InsuranceRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getCreateDept())) {
|
||||
queryWrapper.eq(InsuranceRecord::getCreateDept, insuranceRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getVehicleType())) {
|
||||
queryWrapper.eq(InsuranceRecord::getVehicleType, insuranceRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getVehicleNo())) {
|
||||
queryWrapper.like(InsuranceRecord::getVehicleNo, insuranceRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getInsuranceType())) {
|
||||
queryWrapper.eq(InsuranceRecord::getInsuranceType, insuranceRecord.getInsuranceType());
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(InsuranceRecord::getCreateTime, insuranceRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(insuranceRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(InsuranceRecord::getCreateTime, insuranceRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.MileageRecordExcel;
|
||||
import org.springblade.transport.excel.MileageRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.MileageRecord;
|
||||
import org.springblade.transport.pojo.vo.MileageRecordVO;
|
||||
import org.springblade.transport.service.IMileageRecordService;
|
||||
import org.springblade.transport.wrapper.MileageRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 里程记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "mileage_record")
|
||||
@RequestMapping("/mileage-record")
|
||||
@Tag(name = "里程记录", description = "里程记录")
|
||||
public class MileageRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IMileageRecordService mileageRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入mileageRecord")
|
||||
public R<MileageRecordVO> detail(MileageRecord mileageRecord) {
|
||||
MileageRecord detail = mileageRecordService.getOne(Condition.getQueryWrapper(mileageRecord));
|
||||
return R.data(MileageRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入mileageRecord")
|
||||
public R<IPage<MileageRecordVO>> list(MileageRecordVO mileageRecord, Query query) {
|
||||
IPage<MileageRecordVO> pages = mileageRecordService.selectMileageRecordPage(Condition.getPage(normalizeQuery(query)), mileageRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入mileageRecord")
|
||||
public R submit(@Valid @RequestBody MileageRecord mileageRecord) {
|
||||
return R.status(mileageRecordService.submit(mileageRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(mileageRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-mileage-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入里程记录", description = "传入excel")
|
||||
public R importMileageRecord(MultipartFile file) {
|
||||
MileageRecordImporter mileageRecordImporter = new MileageRecordImporter(mileageRecordService);
|
||||
ExcelUtil.save(file, mileageRecordImporter, MileageRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-mileage-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出里程记录")
|
||||
public void exportMileageRecord(MileageRecordVO mileageRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<MileageRecordExcel> list = mileageRecordService.exportMileageRecord(buildExportQuery(mileageRecord, ids));
|
||||
ExcelUtil.export(response, "里程记录" + DateUtil.time(), "里程记录表", list, MileageRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<MileageRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "里程记录模板", "里程记录表", list, MileageRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MileageRecord> buildExportQuery(MileageRecordVO mileageRecord, String ids) {
|
||||
LambdaQueryWrapper<MileageRecord> queryWrapper = Wrappers.<MileageRecord>lambdaQuery()
|
||||
.eq(MileageRecord::getIsDeleted, 0)
|
||||
.orderByDesc(MileageRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(MileageRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getCreateDept())) {
|
||||
queryWrapper.eq(MileageRecord::getCreateDept, mileageRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getVehicleNo())) {
|
||||
queryWrapper.like(MileageRecord::getVehicleNo, mileageRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getTotalMileageStart())) {
|
||||
queryWrapper.ge(MileageRecord::getTotalMileage, mileageRecord.getTotalMileageStart());
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getTotalMileageEnd())) {
|
||||
queryWrapper.le(MileageRecord::getTotalMileage, mileageRecord.getTotalMileageEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(MileageRecord::getCreateTime, mileageRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(mileageRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(MileageRecord::getCreateTime, mileageRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.OilElectricRecordExcel;
|
||||
import org.springblade.transport.excel.OilElectricRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.OilElectricRecord;
|
||||
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
|
||||
import org.springblade.transport.service.IOilElectricRecordService;
|
||||
import org.springblade.transport.wrapper.OilElectricRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 油电记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "oil_electric_record")
|
||||
@RequestMapping("/oil-electric-record")
|
||||
@Tag(name = "油电记录", description = "油电记录")
|
||||
public class OilElectricRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IOilElectricRecordService oilElectricRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入oilElectricRecord")
|
||||
public R<OilElectricRecordVO> detail(OilElectricRecord oilElectricRecord) {
|
||||
OilElectricRecord detail = oilElectricRecordService.getOne(Condition.getQueryWrapper(oilElectricRecord));
|
||||
return R.data(OilElectricRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入oilElectricRecord")
|
||||
public R<IPage<OilElectricRecordVO>> list(OilElectricRecordVO oilElectricRecord, Query query) {
|
||||
IPage<OilElectricRecordVO> pages = oilElectricRecordService.selectOilElectricRecordPage(Condition.getPage(normalizeQuery(query)), oilElectricRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入oilElectricRecord")
|
||||
public R submit(@Valid @RequestBody OilElectricRecord oilElectricRecord) {
|
||||
return R.status(oilElectricRecordService.submit(oilElectricRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(oilElectricRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-oil-electric-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入油电记录", description = "传入excel")
|
||||
public R importOilElectricRecord(MultipartFile file) {
|
||||
OilElectricRecordImporter oilElectricRecordImporter = new OilElectricRecordImporter(oilElectricRecordService);
|
||||
ExcelUtil.save(file, oilElectricRecordImporter, OilElectricRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-oil-electric-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出油电记录")
|
||||
public void exportOilElectricRecord(OilElectricRecordVO oilElectricRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<OilElectricRecordExcel> list = oilElectricRecordService.exportOilElectricRecord(buildExportQuery(oilElectricRecord, ids));
|
||||
ExcelUtil.export(response, "油电记录" + DateUtil.time(), "油电记录表", list, OilElectricRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<OilElectricRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "油电记录模板", "油电记录表", list, OilElectricRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OilElectricRecord> buildExportQuery(OilElectricRecordVO oilElectricRecord, String ids) {
|
||||
LambdaQueryWrapper<OilElectricRecord> queryWrapper = Wrappers.<OilElectricRecord>lambdaQuery()
|
||||
.eq(OilElectricRecord::getIsDeleted, 0)
|
||||
.orderByDesc(OilElectricRecord::getTransactionTime)
|
||||
.orderByDesc(OilElectricRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(OilElectricRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getCreateDept())) {
|
||||
queryWrapper.eq(OilElectricRecord::getCreateDept, oilElectricRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getVehicleType())) {
|
||||
queryWrapper.eq(OilElectricRecord::getVehicleType, oilElectricRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getFeeType())) {
|
||||
queryWrapper.eq(OilElectricRecord::getFeeType, oilElectricRecord.getFeeType());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getVehicleNo())) {
|
||||
queryWrapper.like(OilElectricRecord::getVehicleNo, oilElectricRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getTransactionTimeStart())) {
|
||||
queryWrapper.ge(OilElectricRecord::getTransactionTime, oilElectricRecord.getTransactionTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getTransactionTimeEnd())) {
|
||||
queryWrapper.le(OilElectricRecord::getTransactionTime, oilElectricRecord.getTransactionTimeEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getTransactionAmountStart())) {
|
||||
queryWrapper.ge(OilElectricRecord::getTransactionAmount, oilElectricRecord.getTransactionAmountStart());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getTransactionAmountEnd())) {
|
||||
queryWrapper.le(OilElectricRecord::getTransactionAmount, oilElectricRecord.getTransactionAmountEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(OilElectricRecord::getCreateTime, oilElectricRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(oilElectricRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(OilElectricRecord::getCreateTime, oilElectricRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.OtherExpenseRecordExcel;
|
||||
import org.springblade.transport.excel.OtherExpenseRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
|
||||
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
|
||||
import org.springblade.transport.service.IOtherExpenseRecordService;
|
||||
import org.springblade.transport.wrapper.OtherExpenseRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 其他费用记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "other_expense_record")
|
||||
@RequestMapping("/other-expense-record")
|
||||
@Tag(name = "其他费用记录", description = "其他费用记录")
|
||||
public class OtherExpenseRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IOtherExpenseRecordService otherExpenseRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入otherExpenseRecord")
|
||||
public R<OtherExpenseRecordVO> detail(OtherExpenseRecord otherExpenseRecord) {
|
||||
OtherExpenseRecord detail = otherExpenseRecordService.getOne(Condition.getQueryWrapper(otherExpenseRecord));
|
||||
return R.data(OtherExpenseRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入otherExpenseRecord")
|
||||
public R<IPage<OtherExpenseRecordVO>> list(OtherExpenseRecordVO otherExpenseRecord, Query query) {
|
||||
IPage<OtherExpenseRecordVO> pages = otherExpenseRecordService.selectOtherExpenseRecordPage(Condition.getPage(normalizeQuery(query)), otherExpenseRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入otherExpenseRecord")
|
||||
public R submit(@Valid @RequestBody OtherExpenseRecord otherExpenseRecord) {
|
||||
return R.status(otherExpenseRecordService.submit(otherExpenseRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(otherExpenseRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-other-expense-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入其他费用记录", description = "传入excel")
|
||||
public R importOtherExpenseRecord(MultipartFile file) {
|
||||
OtherExpenseRecordImporter otherExpenseRecordImporter = new OtherExpenseRecordImporter(otherExpenseRecordService);
|
||||
ExcelUtil.save(file, otherExpenseRecordImporter, OtherExpenseRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-other-expense-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出其他费用记录")
|
||||
public void exportOtherExpenseRecord(OtherExpenseRecordVO otherExpenseRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<OtherExpenseRecordExcel> list = otherExpenseRecordService.exportOtherExpenseRecord(buildExportQuery(otherExpenseRecord, ids));
|
||||
ExcelUtil.export(response, "其他费用记录" + DateUtil.time(), "其他费用记录表", list, OtherExpenseRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<OtherExpenseRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "其他费用记录模板", "其他费用记录表", list, OtherExpenseRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OtherExpenseRecord> buildExportQuery(OtherExpenseRecordVO otherExpenseRecord, String ids) {
|
||||
LambdaQueryWrapper<OtherExpenseRecord> queryWrapper = Wrappers.<OtherExpenseRecord>lambdaQuery()
|
||||
.eq(OtherExpenseRecord::getIsDeleted, 0)
|
||||
.orderByDesc(OtherExpenseRecord::getExpenseDate)
|
||||
.orderByDesc(OtherExpenseRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(OtherExpenseRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getCreateDept())) {
|
||||
queryWrapper.eq(OtherExpenseRecord::getCreateDept, otherExpenseRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getExpenseType())) {
|
||||
queryWrapper.eq(OtherExpenseRecord::getExpenseType, otherExpenseRecord.getExpenseType());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getVehicleType())) {
|
||||
queryWrapper.eq(OtherExpenseRecord::getVehicleType, otherExpenseRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getVehicleNo())) {
|
||||
queryWrapper.like(OtherExpenseRecord::getVehicleNo, otherExpenseRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getExpenseDateStart())) {
|
||||
queryWrapper.ge(OtherExpenseRecord::getExpenseDate, otherExpenseRecord.getExpenseDateStart());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getExpenseDateEnd())) {
|
||||
queryWrapper.le(OtherExpenseRecord::getExpenseDate, otherExpenseRecord.getExpenseDateEnd());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(OtherExpenseRecord::getCreateTime, otherExpenseRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(otherExpenseRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(OtherExpenseRecord::getCreateTime, otherExpenseRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TireReplacementRecordExcel;
|
||||
import org.springblade.transport.excel.TireReplacementRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.TireReplacementRecord;
|
||||
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
|
||||
import org.springblade.transport.service.ITireReplacementRecordService;
|
||||
import org.springblade.transport.wrapper.TireReplacementRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 换胎记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "tire_replacement_record")
|
||||
@RequestMapping("/tire-replacement-record")
|
||||
@Tag(name = "换胎记录", description = "换胎记录")
|
||||
public class TireReplacementRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final ITireReplacementRecordService tireReplacementRecordService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入tireReplacementRecord")
|
||||
public R<TireReplacementRecordVO> detail(TireReplacementRecord tireReplacementRecord) {
|
||||
TireReplacementRecord detail = tireReplacementRecordService.getOne(Condition.getQueryWrapper(tireReplacementRecord));
|
||||
return R.data(TireReplacementRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入tireReplacementRecord")
|
||||
public R<IPage<TireReplacementRecordVO>> list(TireReplacementRecordVO tireReplacementRecord, Query query) {
|
||||
IPage<TireReplacementRecordVO> pages = tireReplacementRecordService.selectTireReplacementRecordPage(Condition.getPage(normalizeQuery(query)), tireReplacementRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入tireReplacementRecord")
|
||||
public R submit(@Valid @RequestBody TireReplacementRecord tireReplacementRecord) {
|
||||
return R.status(tireReplacementRecordService.submit(tireReplacementRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(tireReplacementRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入换胎记录
|
||||
*/
|
||||
@PostMapping("/import-tire-replacement-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入换胎记录", description = "传入excel")
|
||||
public R importTireReplacementRecord(MultipartFile file) {
|
||||
TireReplacementRecordImporter tireReplacementRecordImporter = new TireReplacementRecordImporter(tireReplacementRecordService);
|
||||
ExcelUtil.save(file, tireReplacementRecordImporter, TireReplacementRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出换胎记录
|
||||
*/
|
||||
@GetMapping("/export-tire-replacement-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出换胎记录")
|
||||
public void exportTireReplacementRecord(TireReplacementRecordVO tireReplacementRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<TireReplacementRecordExcel> list = tireReplacementRecordService.exportTireReplacementRecord(buildExportQuery(tireReplacementRecord, ids));
|
||||
ExcelUtil.export(response, "换胎记录" + DateUtil.time(), "换胎记录表", list, TireReplacementRecordExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<TireReplacementRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "换胎记录模板", "换胎记录表", list, TireReplacementRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TireReplacementRecord> buildExportQuery(TireReplacementRecordVO tireReplacementRecord, String ids) {
|
||||
LambdaQueryWrapper<TireReplacementRecord> queryWrapper = Wrappers.<TireReplacementRecord>lambdaQuery()
|
||||
.eq(TireReplacementRecord::getIsDeleted, 0)
|
||||
.orderByDesc(TireReplacementRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(TireReplacementRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(tireReplacementRecord.getCreateDept())) {
|
||||
queryWrapper.eq(TireReplacementRecord::getCreateDept, tireReplacementRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(tireReplacementRecord.getVehicleNo())) {
|
||||
queryWrapper.like(TireReplacementRecord::getVehicleNo, tireReplacementRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(tireReplacementRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(TireReplacementRecord::getCreateTime, tireReplacementRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(tireReplacementRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(TireReplacementRecord::getCreateTime, tireReplacementRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TransportChangeRecordExcel;
|
||||
import org.springblade.transport.excel.TransportChangeRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.TransportChangeRecord;
|
||||
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
|
||||
import org.springblade.transport.service.ITransportChangeRecordService;
|
||||
import org.springblade.transport.wrapper.TransportChangeRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 变更记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "transport_change_record")
|
||||
@RequestMapping("/transport-change-record")
|
||||
@Tag(name = "变更记录", description = "变更记录")
|
||||
public class TransportChangeRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final ITransportChangeRecordService transportChangeRecordService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入transportChangeRecord")
|
||||
public R<TransportChangeRecordVO> detail(TransportChangeRecord transportChangeRecord) {
|
||||
TransportChangeRecord detail = transportChangeRecordService.getOne(Condition.getQueryWrapper(transportChangeRecord));
|
||||
return R.data(TransportChangeRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入transportChangeRecord")
|
||||
public R<IPage<TransportChangeRecordVO>> list(TransportChangeRecordVO transportChangeRecord, Query query) {
|
||||
IPage<TransportChangeRecordVO> pages = transportChangeRecordService.selectTransportChangeRecordPage(Condition.getPage(normalizeQuery(query)), transportChangeRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入transportChangeRecord")
|
||||
public R submit(@Valid @RequestBody TransportChangeRecord transportChangeRecord) {
|
||||
return R.status(transportChangeRecordService.submit(transportChangeRecord));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(transportChangeRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/import-transport-change-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入变更记录", description = "传入excel")
|
||||
public R importTransportChangeRecord(MultipartFile file) {
|
||||
TransportChangeRecordImporter transportChangeRecordImporter = new TransportChangeRecordImporter(transportChangeRecordService);
|
||||
ExcelUtil.save(file, transportChangeRecordImporter, TransportChangeRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
@GetMapping("/export-transport-change-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出变更记录")
|
||||
public void exportTransportChangeRecord(TransportChangeRecordVO transportChangeRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<TransportChangeRecordExcel> list = transportChangeRecordService.exportTransportChangeRecord(buildExportQuery(transportChangeRecord, ids));
|
||||
ExcelUtil.export(response, "变更记录" + DateUtil.time(), "变更记录表", list, TransportChangeRecordExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<TransportChangeRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "变更记录模板", "变更记录表", list, TransportChangeRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TransportChangeRecord> buildExportQuery(TransportChangeRecordVO transportChangeRecord, String ids) {
|
||||
LambdaQueryWrapper<TransportChangeRecord> queryWrapper = Wrappers.<TransportChangeRecord>lambdaQuery()
|
||||
.eq(TransportChangeRecord::getIsDeleted, 0)
|
||||
.orderByDesc(TransportChangeRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(TransportChangeRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getCreateDept())) {
|
||||
queryWrapper.eq(TransportChangeRecord::getCreateDept, transportChangeRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getVehicleType())) {
|
||||
queryWrapper.eq(TransportChangeRecord::getVehicleType, transportChangeRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getVehicleNo())) {
|
||||
queryWrapper.like(TransportChangeRecord::getVehicleNo, transportChangeRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getChangeContent())) {
|
||||
queryWrapper.like(TransportChangeRecord::getChangeContent, transportChangeRecord.getChangeContent());
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(TransportChangeRecord::getCreateTime, transportChangeRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(transportChangeRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(TransportChangeRecord::getCreateTime, transportChangeRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TransportShipExcel;
|
||||
import org.springblade.transport.pojo.entity.TransportShip;
|
||||
import org.springblade.transport.pojo.vo.TransportShipExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportShipVO;
|
||||
import org.springblade.transport.service.ITransportShipService;
|
||||
import org.springblade.transport.wrapper.TransportShipWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 船舶管理 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "transport_ship")
|
||||
@RequestMapping("/transport-ship")
|
||||
@Tag(name = "船舶管理", description = "船舶管理")
|
||||
public class TransportShipController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final ITransportShipService transportShipService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入transportShip")
|
||||
public R<TransportShipVO> detail(TransportShip ship) {
|
||||
TransportShip detail = transportShipService.getOne(Condition.getQueryWrapper(ship));
|
||||
return R.data(TransportShipWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入transportShip")
|
||||
public R<IPage<TransportShipVO>> list(TransportShipVO ship, Query query) {
|
||||
fillExpiryDate(ship);
|
||||
IPage<TransportShipVO> pages = transportShipService.selectTransportShipPage(Condition.getPage(normalizeQuery(query)), ship);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入transportShip")
|
||||
public R submit(@Valid @RequestBody TransportShip ship) {
|
||||
return R.status(transportShipService.submit(ship));
|
||||
}
|
||||
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(transportShipService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/status")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改状态")
|
||||
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
|
||||
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
|
||||
return R.status(transportShipService.changeStatus(id, status));
|
||||
}
|
||||
|
||||
@GetMapping("/expiry-stat")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "证件有效期统计", description = "传入transportShip")
|
||||
public R<TransportShipExpiryStatVO> expiryStat(TransportShipVO ship) {
|
||||
fillExpiryDate(ship);
|
||||
return R.data(transportShipService.expiryStat(ship));
|
||||
}
|
||||
|
||||
@GetMapping("/export-transport-ship")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出船舶")
|
||||
public void exportTransportShip(TransportShipVO ship,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
fillExpiryDate(ship);
|
||||
List<TransportShipExcel> list = transportShipService.exportTransportShip(buildExportQuery(ship, ids));
|
||||
ExcelUtil.export(response, "船舶管理" + DateUtil.time(), "船舶管理表", list, TransportShipExcel.class);
|
||||
}
|
||||
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<TransportShipExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "船舶管理模板", "船舶管理表", list, TransportShipExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private void fillExpiryDate(TransportShipVO ship) {
|
||||
if (ship.getToday() == null) {
|
||||
ship.setToday(LocalDate.now());
|
||||
}
|
||||
if (ship.getWarningDate() == null) {
|
||||
ship.setWarningDate(ship.getToday().plusDays(30));
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TransportShip> buildExportQuery(TransportShipVO ship, String ids) {
|
||||
LambdaQueryWrapper<TransportShip> queryWrapper = Wrappers.<TransportShip>lambdaQuery()
|
||||
.eq(TransportShip::getIsDeleted, 0)
|
||||
.orderByDesc(TransportShip::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(TransportShip::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getShipName())) {
|
||||
queryWrapper.like(TransportShip::getShipName, ship.getShipName());
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getShipIdentifierNo())) {
|
||||
queryWrapper.like(TransportShip::getShipIdentifierNo, ship.getShipIdentifierNo());
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getOrganizationName())) {
|
||||
queryWrapper.like(TransportShip::getOrganizationName, ship.getOrganizationName());
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getShipInspectionNo())) {
|
||||
queryWrapper.like(TransportShip::getShipInspectionNo, ship.getShipInspectionNo());
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getShipType())) {
|
||||
queryWrapper.eq(TransportShip::getShipType, ship.getShipType());
|
||||
}
|
||||
if (Func.isNotEmpty(ship.getStatus())) {
|
||||
queryWrapper.eq(TransportShip::getStatus, ship.getStatus());
|
||||
}
|
||||
if ("within30".equals(ship.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(TransportShip::getNationalityCertLongTerm, 1)
|
||||
.between(TransportShip::getNationalityCertEndDate, ship.getToday(), ship.getWarningDate()))
|
||||
.or(item -> item.ne(TransportShip::getSafeManningCertLongTerm, 1)
|
||||
.between(TransportShip::getSafeManningCertEndDate, ship.getToday(), ship.getWarningDate()))
|
||||
.or(item -> item.ne(TransportShip::getBusinessTransportCertLongTerm, 1)
|
||||
.between(TransportShip::getBusinessTransportCertEndDate, ship.getToday(), ship.getWarningDate()))
|
||||
.or(item -> item.ne(TransportShip::getLeaseLongTerm, 1)
|
||||
.between(TransportShip::getLeaseEndDate, ship.getToday(), ship.getWarningDate())));
|
||||
}
|
||||
if ("expired".equals(ship.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(TransportShip::getNationalityCertLongTerm, 1)
|
||||
.lt(TransportShip::getNationalityCertEndDate, ship.getToday()))
|
||||
.or(item -> item.ne(TransportShip::getSafeManningCertLongTerm, 1)
|
||||
.lt(TransportShip::getSafeManningCertEndDate, ship.getToday()))
|
||||
.or(item -> item.ne(TransportShip::getBusinessTransportCertLongTerm, 1)
|
||||
.lt(TransportShip::getBusinessTransportCertEndDate, ship.getToday()))
|
||||
.or(item -> item.ne(TransportShip::getLeaseLongTerm, 1)
|
||||
.lt(TransportShip::getLeaseEndDate, ship.getToday())));
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TransportVehicleExcel;
|
||||
import org.springblade.transport.pojo.entity.TransportVehicle;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleVO;
|
||||
import org.springblade.transport.service.ITransportVehicleService;
|
||||
import org.springblade.transport.wrapper.TransportVehicleWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆管理 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "transport_vehicle")
|
||||
@RequestMapping("/transport-vehicle")
|
||||
@Tag(name = "车辆管理", description = "车辆管理")
|
||||
public class TransportVehicleController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final ITransportVehicleService transportVehicleService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入transportVehicle")
|
||||
public R<TransportVehicleVO> detail(TransportVehicle vehicle) {
|
||||
TransportVehicle detail = transportVehicleService.getOne(Condition.getQueryWrapper(vehicle));
|
||||
return R.data(TransportVehicleWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入transportVehicle")
|
||||
public R<IPage<TransportVehicleVO>> list(TransportVehicleVO vehicle, Query query) {
|
||||
fillExpiryDate(vehicle);
|
||||
IPage<TransportVehicleVO> pages = transportVehicleService.selectTransportVehiclePage(Condition.getPage(normalizeQuery(query)), vehicle);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入transportVehicle")
|
||||
public R submit(@Valid @RequestBody TransportVehicle vehicle) {
|
||||
return R.status(transportVehicleService.submit(vehicle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(transportVehicleService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
@PostMapping("/status")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改状态")
|
||||
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
|
||||
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
|
||||
return R.status(transportVehicleService.changeStatus(id, status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*/
|
||||
@GetMapping("/expiry-stat")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "证件有效期统计", description = "传入transportVehicle")
|
||||
public R<TransportVehicleExpiryStatVO> expiryStat(TransportVehicleVO vehicle) {
|
||||
fillExpiryDate(vehicle);
|
||||
return R.data(transportVehicleService.expiryStat(vehicle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆
|
||||
*/
|
||||
@GetMapping("/export-transport-vehicle")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出车辆")
|
||||
public void exportTransportVehicle(TransportVehicleVO vehicle,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
fillExpiryDate(vehicle);
|
||||
List<TransportVehicleExcel> list = transportVehicleService.exportTransportVehicle(buildExportQuery(vehicle, ids));
|
||||
ExcelUtil.export(response, "车辆管理" + DateUtil.time(), "车辆管理表", list, TransportVehicleExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<TransportVehicleExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "车辆管理模板", "车辆管理表", list, TransportVehicleExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private void fillExpiryDate(TransportVehicleVO vehicle) {
|
||||
if (vehicle.getToday() == null) {
|
||||
vehicle.setToday(LocalDate.now());
|
||||
}
|
||||
if (vehicle.getWarningDate() == null) {
|
||||
vehicle.setWarningDate(vehicle.getToday().plusDays(30));
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TransportVehicle> buildExportQuery(TransportVehicleVO vehicle, String ids) {
|
||||
LambdaQueryWrapper<TransportVehicle> queryWrapper = Wrappers.<TransportVehicle>lambdaQuery()
|
||||
.eq(TransportVehicle::getIsDeleted, 0)
|
||||
.orderByDesc(TransportVehicle::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(TransportVehicle::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getOrganizationName())) {
|
||||
queryWrapper.like(TransportVehicle::getOrganizationName, vehicle.getOrganizationName());
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getPlateNo())) {
|
||||
queryWrapper.like(TransportVehicle::getPlateNo, vehicle.getPlateNo());
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getVehicleType())) {
|
||||
queryWrapper.eq(TransportVehicle::getVehicleType, vehicle.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getBusinessRelation())) {
|
||||
queryWrapper.eq(TransportVehicle::getBusinessRelation, vehicle.getBusinessRelation());
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getEnergyType())) {
|
||||
queryWrapper.eq(TransportVehicle::getEnergyType, vehicle.getEnergyType());
|
||||
}
|
||||
if (Func.isNotEmpty(vehicle.getStatus())) {
|
||||
queryWrapper.eq(TransportVehicle::getStatus, vehicle.getStatus());
|
||||
}
|
||||
if ("within30".equals(vehicle.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(TransportVehicle::getCompulsoryScrapLongTerm, 1)
|
||||
.between(TransportVehicle::getCompulsoryScrapDate, vehicle.getToday(), vehicle.getWarningDate()))
|
||||
.or(item -> item.ne(TransportVehicle::getDrivingLicenseLongTerm, 1)
|
||||
.between(TransportVehicle::getDrivingLicenseEndDate, vehicle.getToday(), vehicle.getWarningDate()))
|
||||
.or(item -> item.ne(TransportVehicle::getRoadTransportCertLongTerm, 1)
|
||||
.between(TransportVehicle::getRoadTransportCertEndDate, vehicle.getToday(), vehicle.getWarningDate()))
|
||||
.or(item -> item.ne(TransportVehicle::getAnnualReviewLongTerm, 1)
|
||||
.between(TransportVehicle::getAnnualReviewEndDate, vehicle.getToday(), vehicle.getWarningDate())));
|
||||
}
|
||||
if ("expired".equals(vehicle.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(TransportVehicle::getCompulsoryScrapLongTerm, 1)
|
||||
.lt(TransportVehicle::getCompulsoryScrapDate, vehicle.getToday()))
|
||||
.or(item -> item.ne(TransportVehicle::getDrivingLicenseLongTerm, 1)
|
||||
.lt(TransportVehicle::getDrivingLicenseEndDate, vehicle.getToday()))
|
||||
.or(item -> item.ne(TransportVehicle::getRoadTransportCertLongTerm, 1)
|
||||
.lt(TransportVehicle::getRoadTransportCertEndDate, vehicle.getToday()))
|
||||
.or(item -> item.ne(TransportVehicle::getAnnualReviewLongTerm, 1)
|
||||
.lt(TransportVehicle::getAnnualReviewEndDate, vehicle.getToday())));
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.ViolationRecordExcel;
|
||||
import org.springblade.transport.excel.ViolationRecordImporter;
|
||||
import org.springblade.transport.pojo.entity.ViolationRecord;
|
||||
import org.springblade.transport.pojo.vo.ViolationRecordVO;
|
||||
import org.springblade.transport.service.IViolationRecordService;
|
||||
import org.springblade.transport.wrapper.ViolationRecordWrapper;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违章记录 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@PreAuth(menu = "violation_record")
|
||||
@RequestMapping("/violation-record")
|
||||
@Tag(name = "违章记录", description = "违章记录")
|
||||
public class ViolationRecordController extends BladeController {
|
||||
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
|
||||
private final IViolationRecordService violationRecordService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入violationRecord")
|
||||
public R<ViolationRecordVO> detail(ViolationRecord violationRecord) {
|
||||
ViolationRecord detail = violationRecordService.getOne(Condition.getQueryWrapper(violationRecord));
|
||||
return R.data(ViolationRecordWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入violationRecord")
|
||||
public R<IPage<ViolationRecordVO>> list(ViolationRecordVO violationRecord, Query query) {
|
||||
IPage<ViolationRecordVO> pages = violationRecordService.selectViolationRecordPage(Condition.getPage(normalizeQuery(query)), violationRecord);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入violationRecord")
|
||||
public R submit(@Valid @RequestBody ViolationRecord violationRecord) {
|
||||
return R.status(violationRecordService.submit(violationRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(violationRecordService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入违章记录
|
||||
*/
|
||||
@PostMapping("/import-violation-record")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "导入违章记录", description = "传入excel")
|
||||
public R importViolationRecord(MultipartFile file) {
|
||||
ViolationRecordImporter violationRecordImporter = new ViolationRecordImporter(violationRecordService);
|
||||
ExcelUtil.save(file, violationRecordImporter, ViolationRecordExcel.class);
|
||||
return R.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出违章记录
|
||||
*/
|
||||
@GetMapping("/export-violation-record")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "导出违章记录")
|
||||
public void exportViolationRecord(ViolationRecordVO violationRecord,
|
||||
@RequestParam(required = false) String ids,
|
||||
HttpServletResponse response) {
|
||||
List<ViolationRecordExcel> list = violationRecordService.exportViolationRecord(buildExportQuery(violationRecord, ids));
|
||||
ExcelUtil.export(response, "违章记录" + DateUtil.time(), "违章记录表", list, ViolationRecordExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("/export-template")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "导出模板")
|
||||
public void exportTemplate(HttpServletResponse response) {
|
||||
List<ViolationRecordExcel> list = new ArrayList<>();
|
||||
ExcelUtil.export(response, "违章记录模板", "违章记录表", list, ViolationRecordExcel.class);
|
||||
}
|
||||
|
||||
private Query normalizeQuery(Query query) {
|
||||
if (query == null) {
|
||||
query = new Query();
|
||||
}
|
||||
if (query.getCurrent() == null || query.getCurrent() < DEFAULT_CURRENT) {
|
||||
query.setCurrent(DEFAULT_CURRENT);
|
||||
}
|
||||
if (query.getSize() == null || query.getSize() <= 0) {
|
||||
query.setSize(DEFAULT_SIZE);
|
||||
}
|
||||
if (query.getSize() > MAX_SIZE) {
|
||||
query.setSize(MAX_SIZE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ViolationRecord> buildExportQuery(ViolationRecordVO violationRecord, String ids) {
|
||||
LambdaQueryWrapper<ViolationRecord> queryWrapper = Wrappers.<ViolationRecord>lambdaQuery()
|
||||
.eq(ViolationRecord::getIsDeleted, 0)
|
||||
.orderByDesc(ViolationRecord::getCreateTime);
|
||||
if (Func.isNotEmpty(ids)) {
|
||||
queryWrapper.in(ViolationRecord::getId, Func.toLongList(ids));
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getCreateDept())) {
|
||||
queryWrapper.eq(ViolationRecord::getCreateDept, violationRecord.getCreateDept());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getVehicleType())) {
|
||||
queryWrapper.eq(ViolationRecord::getVehicleType, violationRecord.getVehicleType());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getVehicleNo())) {
|
||||
queryWrapper.like(ViolationRecord::getVehicleNo, violationRecord.getVehicleNo());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getDriverName())) {
|
||||
queryWrapper.like(ViolationRecord::getDriverName, violationRecord.getDriverName());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getProcessStatus())) {
|
||||
queryWrapper.eq(ViolationRecord::getProcessStatus, violationRecord.getProcessStatus());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getCreateTimeStart())) {
|
||||
queryWrapper.ge(ViolationRecord::getCreateTime, violationRecord.getCreateTimeStart());
|
||||
}
|
||||
if (Func.isNotEmpty(violationRecord.getCreateTimeEnd())) {
|
||||
queryWrapper.le(ViolationRecord::getCreateTime, violationRecord.getCreateTimeEnd());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 事故记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class AccidentRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("事故发生日期")
|
||||
private LocalDate accidentDate;
|
||||
|
||||
@ExcelProperty("事故发生地点")
|
||||
private String accidentLocation;
|
||||
|
||||
@ExcelProperty("事故性质")
|
||||
private String accidentNature;
|
||||
|
||||
@ExcelProperty("事故责任")
|
||||
private String accidentResponsibility;
|
||||
|
||||
@ExcelProperty("直接经济损失")
|
||||
private BigDecimal directEconomicLoss;
|
||||
|
||||
@ExcelProperty("保险理赔金额")
|
||||
private BigDecimal insuranceClaimAmount;
|
||||
|
||||
@ExcelProperty("事故原因及损坏情况")
|
||||
private String accidentReasonDamage;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IAccidentRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class AccidentRecordImporter implements ExcelImporter<AccidentRecordExcel> {
|
||||
|
||||
private final IAccidentRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<AccidentRecordExcel> data) {
|
||||
service.importAccidentRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 年检记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class AnnualInspectionRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("检测评定日期")
|
||||
private LocalDate inspectionAssessmentDate;
|
||||
|
||||
@ExcelProperty("车辆技术等级/船舶检验类型")
|
||||
private String inspectionContent;
|
||||
|
||||
@ExcelProperty("有效期截止日")
|
||||
private LocalDate validUntilDate;
|
||||
|
||||
@ExcelProperty("客车类型及等级")
|
||||
private String passengerTypeLevel;
|
||||
|
||||
@ExcelProperty("检测评定单位")
|
||||
private String inspectionUnit;
|
||||
|
||||
@ExcelProperty("费用")
|
||||
private BigDecimal fee;
|
||||
|
||||
@ExcelProperty("评定(复核)单位")
|
||||
private String assessmentUnit;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IAnnualInspectionRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 年检记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class AnnualInspectionRecordImporter implements ExcelImporter<AnnualInspectionRecordExcel> {
|
||||
|
||||
private final IAnnualInspectionRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<AnnualInspectionRecordExcel> data) {
|
||||
service.importAnnualInspectionRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 客商档案 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class CustomerArchiveExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty("客商编号")
|
||||
private String customerCode;
|
||||
|
||||
@ExcelProperty("客商简称")
|
||||
private String shortName;
|
||||
|
||||
@ExcelProperty("客商名称")
|
||||
private String fullName;
|
||||
|
||||
@ExcelProperty("客商类型")
|
||||
private String customerType;
|
||||
|
||||
@ExcelProperty("客商性质")
|
||||
private String customerNature;
|
||||
|
||||
@ExcelProperty("统一信用代码")
|
||||
private String unifiedCreditCode;
|
||||
|
||||
@ExcelProperty("所属组织")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("准入类型")
|
||||
private String accessTypeName;
|
||||
|
||||
@ExcelProperty("审批状态")
|
||||
private String approvalStatusName;
|
||||
|
||||
@ExcelProperty("当前节点")
|
||||
private String currentNode;
|
||||
|
||||
@ExcelProperty("当前处理人")
|
||||
private String currentProcessor;
|
||||
|
||||
@ExcelProperty("审核通过时间")
|
||||
private LocalDateTime approvedTime;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String statusName;
|
||||
|
||||
@ExcelProperty("客户等级")
|
||||
private String customerLevel;
|
||||
|
||||
@ExcelProperty("最大资金使用额度(万元)")
|
||||
private BigDecimal maxCreditLimit;
|
||||
|
||||
@ExcelProperty("申请总资金使用额度(万元)")
|
||||
private BigDecimal applyCreditLimit;
|
||||
|
||||
@ExcelProperty("联系电话")
|
||||
private String contactPhone;
|
||||
|
||||
@ExcelProperty("法人/负责人")
|
||||
private String legalPerson;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 司机管理 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class DriverExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("司机姓名")
|
||||
private String driverName;
|
||||
|
||||
@ExcelProperty("身份证号")
|
||||
private String idCardNo;
|
||||
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty("性别")
|
||||
private String gender;
|
||||
|
||||
@ExcelProperty("司机类型")
|
||||
private String driverType;
|
||||
|
||||
@ExcelProperty("岗位")
|
||||
private String posts;
|
||||
|
||||
@ExcelProperty("所属组织")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String statusName;
|
||||
|
||||
@ExcelProperty("准驾车型")
|
||||
private String drivingType;
|
||||
|
||||
@ExcelProperty("驾驶证档案编号")
|
||||
private String drivingLicenseNo;
|
||||
|
||||
@ExcelProperty("驾驶证有效期起")
|
||||
private LocalDate drivingLicenseStartDate;
|
||||
|
||||
@ExcelProperty("驾驶证有效期止")
|
||||
private LocalDate drivingLicenseEndDate;
|
||||
|
||||
@ExcelProperty("驾驶证长期有效")
|
||||
private String drivingLicenseLongTermName;
|
||||
|
||||
@ExcelProperty("从业资格证类型")
|
||||
private String qualificationType;
|
||||
|
||||
@ExcelProperty("资格证号")
|
||||
private String qualificationNo;
|
||||
|
||||
@ExcelProperty("从业资格证有效期止")
|
||||
private LocalDate qualificationEndDate;
|
||||
|
||||
@ExcelProperty("从业资格证长期有效")
|
||||
private String qualificationLongTermName;
|
||||
|
||||
@ExcelProperty("紧急联系人")
|
||||
private String emergencyContactName;
|
||||
|
||||
@ExcelProperty("紧急联系人手机号")
|
||||
private String emergencyContactMobile;
|
||||
|
||||
@ExcelProperty("与联系人关系")
|
||||
private String contactRelation;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* ETC记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class EtcRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车牌号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("ETC卡号")
|
||||
private String etcCardNo;
|
||||
|
||||
@ExcelProperty("入口时间")
|
||||
private LocalDateTime entryTime;
|
||||
|
||||
@ExcelProperty("出口时间")
|
||||
private LocalDateTime exitTime;
|
||||
|
||||
@ExcelProperty("入口站")
|
||||
private String entryStation;
|
||||
|
||||
@ExcelProperty("出口站")
|
||||
private String exitStation;
|
||||
|
||||
@ExcelProperty("交易金额")
|
||||
private BigDecimal transactionAmount;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IEtcRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ETC记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class EtcRecordImporter implements ExcelImporter<EtcRecordExcel> {
|
||||
|
||||
private final IEtcRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<EtcRecordExcel> data) {
|
||||
service.importEtcRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 保险记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class InsuranceRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("保险类型")
|
||||
private String insuranceType;
|
||||
|
||||
@ExcelProperty("保单号")
|
||||
private String policyNo;
|
||||
|
||||
@ExcelProperty("开始日期")
|
||||
private LocalDate startDate;
|
||||
|
||||
@ExcelProperty("结束日期")
|
||||
private LocalDate endDate;
|
||||
|
||||
@ExcelProperty("保额")
|
||||
private BigDecimal insuredAmount;
|
||||
|
||||
@ExcelProperty("保费")
|
||||
private BigDecimal premium;
|
||||
|
||||
@ExcelProperty("发票号")
|
||||
private String invoiceNo;
|
||||
|
||||
@ExcelProperty("开票日期")
|
||||
private LocalDate invoiceDate;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IInsuranceRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保险记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class InsuranceRecordImporter implements ExcelImporter<InsuranceRecordExcel> {
|
||||
|
||||
private final IInsuranceRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<InsuranceRecordExcel> data) {
|
||||
service.importInsuranceRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 里程记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class MileageRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车牌号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("上月统计里程")
|
||||
private BigDecimal previousMonthMileage;
|
||||
|
||||
@ExcelProperty("本月统计里程")
|
||||
private BigDecimal currentMonthMileage;
|
||||
|
||||
@ExcelProperty("本月行驶里程")
|
||||
private BigDecimal monthlyMileage;
|
||||
|
||||
@ExcelProperty("累计行驶里程")
|
||||
private BigDecimal totalMileage;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IMileageRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 里程记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class MileageRecordImporter implements ExcelImporter<MileageRecordExcel> {
|
||||
|
||||
private final IMileageRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<MileageRecordExcel> data) {
|
||||
service.importMileageRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 油电记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class OilElectricRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("交易时间")
|
||||
private LocalDateTime transactionTime;
|
||||
|
||||
@ExcelProperty("费用类型")
|
||||
private String feeType;
|
||||
|
||||
@ExcelProperty("交易金额")
|
||||
private BigDecimal transactionAmount;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ExcelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ExcelProperty("持卡人")
|
||||
private String cardHolder;
|
||||
|
||||
@ExcelProperty("余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ExcelProperty("油品")
|
||||
private String oilProduct;
|
||||
|
||||
@ExcelProperty("站点")
|
||||
private String station;
|
||||
|
||||
@ExcelProperty("卡号")
|
||||
private String cardNo;
|
||||
|
||||
@ExcelProperty("数据来源")
|
||||
private String dataSource;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IOilElectricRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 油电记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class OilElectricRecordImporter implements ExcelImporter<OilElectricRecordExcel> {
|
||||
|
||||
private final IOilElectricRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<OilElectricRecordExcel> data) {
|
||||
service.importOilElectricRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 其他费用记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(22)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class OtherExpenseRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("费用日期")
|
||||
private LocalDate expenseDate;
|
||||
|
||||
@ExcelProperty("费用类型")
|
||||
private String expenseType;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IOtherExpenseRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 其他费用记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class OtherExpenseRecordImporter implements ExcelImporter<OtherExpenseRecordExcel> {
|
||||
|
||||
private final IOtherExpenseRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<OtherExpenseRecordExcel> data) {
|
||||
service.importOtherExpenseRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 换胎记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class TireReplacementRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车牌号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("处理人")
|
||||
private String handler;
|
||||
|
||||
@ExcelProperty("换胎时间")
|
||||
private LocalDate replacementTime;
|
||||
|
||||
@ExcelProperty("轮胎品牌")
|
||||
private String tireBrand;
|
||||
|
||||
@ExcelProperty("换胎数量")
|
||||
private Integer tireQuantity;
|
||||
|
||||
@ExcelProperty("换胎费用")
|
||||
private BigDecimal replacementCost;
|
||||
|
||||
@ExcelProperty("换胎说明")
|
||||
private String replacementDescription;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.ITireReplacementRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 换胎记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class TireReplacementRecordImporter implements ExcelImporter<TireReplacementRecordExcel> {
|
||||
|
||||
private final ITireReplacementRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<TireReplacementRecordExcel> data) {
|
||||
service.importTireReplacementRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 变更记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(24)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class TransportChangeRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("变更事项")
|
||||
private String changeItem;
|
||||
|
||||
@ExcelProperty("变更内容")
|
||||
private String changeContent;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.ITransportChangeRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 变更记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class TransportChangeRecordImporter implements ExcelImporter<TransportChangeRecordExcel> {
|
||||
|
||||
private final ITransportChangeRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<TransportChangeRecordExcel> data) {
|
||||
service.importTransportChangeRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 船舶管理 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class TransportShipExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("船舶名")
|
||||
private String shipName;
|
||||
|
||||
@ExcelProperty("船舶识别号")
|
||||
private String shipIdentifierNo;
|
||||
|
||||
@ExcelProperty("所属组织")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("船检登记号")
|
||||
private String shipInspectionNo;
|
||||
|
||||
@ExcelProperty("船舶类型")
|
||||
private String shipType;
|
||||
|
||||
@ExcelProperty("国籍证有效期至")
|
||||
private LocalDate nationalityCertEndDate;
|
||||
|
||||
@ExcelProperty("国籍证长期有效")
|
||||
private String nationalityCertLongTermName;
|
||||
|
||||
@ExcelProperty("最低安全配员证书有效期至")
|
||||
private LocalDate safeManningCertEndDate;
|
||||
|
||||
@ExcelProperty("最低安全配员证书长期有效")
|
||||
private String safeManningCertLongTermName;
|
||||
|
||||
@ExcelProperty("营业运输证有效期至")
|
||||
private LocalDate businessTransportCertEndDate;
|
||||
|
||||
@ExcelProperty("营业运输证长期有效")
|
||||
private String businessTransportCertLongTermName;
|
||||
|
||||
@ExcelProperty("承租有效期至")
|
||||
private LocalDate leaseEndDate;
|
||||
|
||||
@ExcelProperty("承租长期有效")
|
||||
private String leaseLongTermName;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String statusName;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 车辆管理 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class TransportVehicleExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("所属组织")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
@ExcelProperty("车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("外廓长度(mm)")
|
||||
private Integer outerLength;
|
||||
|
||||
@ExcelProperty("外廓宽度(mm)")
|
||||
private Integer outerWidth;
|
||||
|
||||
@ExcelProperty("外廓高度(mm)")
|
||||
private Integer outerHeight;
|
||||
|
||||
@ExcelProperty("核定载质量(KG)")
|
||||
private Integer approvedLoadKg;
|
||||
|
||||
@ExcelProperty("准牵引总质量(KG)")
|
||||
private Integer tractionMassKg;
|
||||
|
||||
@ExcelProperty("业务关系")
|
||||
private String businessRelation;
|
||||
|
||||
@ExcelProperty("能源类型")
|
||||
private String energyType;
|
||||
|
||||
@ExcelProperty("强制报废日期")
|
||||
private LocalDate compulsoryScrapDate;
|
||||
|
||||
@ExcelProperty("强制报废长期有效")
|
||||
private String compulsoryScrapLongTermName;
|
||||
|
||||
@ExcelProperty("海关备案号")
|
||||
private String customsRecordNo;
|
||||
|
||||
@ExcelProperty("行驶证档案编号")
|
||||
private String drivingLicenseNo;
|
||||
|
||||
@ExcelProperty("行驶证有效期起")
|
||||
private LocalDate drivingLicenseStartDate;
|
||||
|
||||
@ExcelProperty("行驶证有效期止")
|
||||
private LocalDate drivingLicenseEndDate;
|
||||
|
||||
@ExcelProperty("行驶证长期有效")
|
||||
private String drivingLicenseLongTermName;
|
||||
|
||||
@ExcelProperty("道路运输证号")
|
||||
private String roadTransportCertNo;
|
||||
|
||||
@ExcelProperty("道路运输证有效期起")
|
||||
private LocalDate roadTransportCertStartDate;
|
||||
|
||||
@ExcelProperty("道路运输证有效期止")
|
||||
private LocalDate roadTransportCertEndDate;
|
||||
|
||||
@ExcelProperty("道路运输证长期有效")
|
||||
private String roadTransportCertLongTermName;
|
||||
|
||||
@ExcelProperty("道路运输年审有效期")
|
||||
private LocalDate annualReviewEndDate;
|
||||
|
||||
@ExcelProperty("道路运输年审长期有效")
|
||||
private String annualReviewLongTermName;
|
||||
|
||||
@ExcelProperty("机动车登记编号")
|
||||
private String registrationNo;
|
||||
|
||||
@ExcelProperty("机动车登记日期")
|
||||
private LocalDate registrationDate;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String statusName;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 违章记录 Excel
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(18)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class ViolationRecordExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("车船类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ExcelProperty("车牌号/船号")
|
||||
private String vehicleNo;
|
||||
|
||||
@ExcelProperty("驾驶人")
|
||||
private String driverName;
|
||||
|
||||
@ExcelProperty("类型/事项")
|
||||
private String violationContent;
|
||||
|
||||
@ExcelProperty("时间")
|
||||
private LocalDateTime violationTime;
|
||||
|
||||
@ExcelProperty("地址")
|
||||
private String location;
|
||||
|
||||
@ExcelProperty("被罚金额")
|
||||
private BigDecimal fineAmount;
|
||||
|
||||
@ExcelProperty("被扣分数")
|
||||
private Integer deductPoints;
|
||||
|
||||
@ExcelProperty("被罚单位")
|
||||
private String penaltyUnit;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String processStatus;
|
||||
|
||||
@ExcelProperty("过程描述")
|
||||
private String processDescription;
|
||||
|
||||
@ExcelProperty("处理结果")
|
||||
private String processResult;
|
||||
|
||||
@ExcelProperty("报错文案")
|
||||
private String errorMessage;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.excel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.excel.support.ExcelImporter;
|
||||
import org.springblade.transport.service.IViolationRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违章记录导入类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class ViolationRecordImporter implements ExcelImporter<ViolationRecordExcel> {
|
||||
|
||||
private final IViolationRecordService service;
|
||||
|
||||
@Override
|
||||
public void save(List<ViolationRecordExcel> data) {
|
||||
service.importViolationRecord(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.AccidentRecord;
|
||||
import org.springblade.transport.pojo.vo.AccidentRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface AccidentRecordMapper extends BaseMapper<AccidentRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param accidentRecord 查询参数
|
||||
* @return 事故记录分页
|
||||
*/
|
||||
List<AccidentRecordVO> selectAccidentRecordPage(IPage<AccidentRecordVO> page, AccidentRecordVO accidentRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?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="org.springblade.transport.mapper.AccidentRecordMapper">
|
||||
|
||||
<resultMap id="accidentRecordResultMap" type="org.springblade.transport.pojo.vo.AccidentRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="accident_date" property="accidentDate"/>
|
||||
<result column="accident_location" property="accidentLocation"/>
|
||||
<result column="accident_nature" property="accidentNature"/>
|
||||
<result column="accident_responsibility" property="accidentResponsibility"/>
|
||||
<result column="direct_economic_loss" property="directEconomicLoss"/>
|
||||
<result column="insurance_claim_amount" property="insuranceClaimAmount"/>
|
||||
<result column="accident_reason_damage" property="accidentReasonDamage"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAccidentRecordPage" resultMap="accidentRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
accident_date,
|
||||
accident_location,
|
||||
accident_nature,
|
||||
accident_responsibility,
|
||||
CASE WHEN direct_economic_loss < 0 THEN 0 ELSE direct_economic_loss END AS direct_economic_loss,
|
||||
CASE WHEN insurance_claim_amount < 0 THEN 0 ELSE insurance_claim_amount END AS insurance_claim_amount,
|
||||
accident_reason_damage,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_accident_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="accidentRecord.createDept != null">
|
||||
AND create_dept = #{accidentRecord.createDept}
|
||||
</if>
|
||||
<if test="accidentRecord.vehicleType != null and accidentRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{accidentRecord.vehicleType}
|
||||
</if>
|
||||
<if test="accidentRecord.vehicleNo != null and accidentRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + accidentRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="accidentRecord.accidentNature != null and accidentRecord.accidentNature != ''">
|
||||
AND accident_nature = #{accidentRecord.accidentNature}
|
||||
</if>
|
||||
<if test="accidentRecord.accidentResponsibility != null and accidentRecord.accidentResponsibility != ''">
|
||||
AND accident_responsibility = #{accidentRecord.accidentResponsibility}
|
||||
</if>
|
||||
<if test="accidentRecord.accidentReasonDamage != null and accidentRecord.accidentReasonDamage != ''">
|
||||
<bind name="reasonLike" value="'%' + accidentRecord.accidentReasonDamage + '%'"/>
|
||||
AND accident_reason_damage LIKE #{reasonLike}
|
||||
</if>
|
||||
<if test="accidentRecord.accidentAssessmentDateStart != null">
|
||||
AND accident_date >= #{accidentRecord.accidentAssessmentDateStart}
|
||||
</if>
|
||||
<if test="accidentRecord.accidentAssessmentDateEnd != null">
|
||||
AND accident_date <= #{accidentRecord.accidentAssessmentDateEnd}
|
||||
</if>
|
||||
<if test="accidentRecord.createTimeStart != null and accidentRecord.createTimeStart != ''">
|
||||
AND create_time >= #{accidentRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="accidentRecord.createTimeEnd != null and accidentRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{accidentRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
|
||||
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 年检记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface AnnualInspectionRecordMapper extends BaseMapper<AnnualInspectionRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param annualInspectionRecord 查询参数
|
||||
* @return 年检记录分页
|
||||
*/
|
||||
List<AnnualInspectionRecordVO> selectAnnualInspectionRecordPage(IPage<AnnualInspectionRecordVO> page, AnnualInspectionRecordVO annualInspectionRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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="org.springblade.transport.mapper.AnnualInspectionRecordMapper">
|
||||
|
||||
<resultMap id="annualInspectionRecordResultMap" type="org.springblade.transport.pojo.vo.AnnualInspectionRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="inspection_assessment_date" property="inspectionAssessmentDate"/>
|
||||
<result column="vehicle_technical_level" property="vehicleTechnicalLevel"/>
|
||||
<result column="ship_inspection_type" property="shipInspectionType"/>
|
||||
<result column="valid_until_date" property="validUntilDate"/>
|
||||
<result column="passenger_type_level" property="passengerTypeLevel"/>
|
||||
<result column="inspection_unit" property="inspectionUnit"/>
|
||||
<result column="fee" property="fee"/>
|
||||
<result column="assessment_unit" property="assessmentUnit"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAnnualInspectionRecordPage" resultMap="annualInspectionRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
inspection_assessment_date,
|
||||
vehicle_technical_level,
|
||||
ship_inspection_type,
|
||||
valid_until_date,
|
||||
passenger_type_level,
|
||||
inspection_unit,
|
||||
CASE WHEN fee < 0 THEN 0 ELSE fee END AS fee,
|
||||
assessment_unit,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_annual_inspection_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="annualInspectionRecord.createDept != null">
|
||||
AND create_dept = #{annualInspectionRecord.createDept}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.vehicleType != null and annualInspectionRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{annualInspectionRecord.vehicleType}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.vehicleNo != null and annualInspectionRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + annualInspectionRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.inspectionAssessmentDateStart != null">
|
||||
AND inspection_assessment_date >= #{annualInspectionRecord.inspectionAssessmentDateStart}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.inspectionAssessmentDateEnd != null">
|
||||
AND inspection_assessment_date <= #{annualInspectionRecord.inspectionAssessmentDateEnd}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.createTimeStart != null and annualInspectionRecord.createTimeStart != ''">
|
||||
AND create_time >= #{annualInspectionRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="annualInspectionRecord.createTimeEnd != null and annualInspectionRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{annualInspectionRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客商档案 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerArchiveMapper extends BaseMapper<CustomerArchive> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param customer 查询参数
|
||||
* @return 客商档案列表
|
||||
*/
|
||||
List<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page, @Param("customer") CustomerArchiveVO customer);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?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="org.springblade.transport.mapper.CustomerArchiveMapper">
|
||||
|
||||
<resultMap id="customerArchiveResultMap" type="org.springblade.transport.pojo.vo.CustomerArchiveVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="customer_code" property="customerCode"/>
|
||||
<result column="short_name" property="shortName"/>
|
||||
<result column="full_name" property="fullName"/>
|
||||
<result column="customer_nature" property="customerNature"/>
|
||||
<result column="unified_credit_code" property="unifiedCreditCode"/>
|
||||
<result column="customer_type" property="customerType"/>
|
||||
<result column="project_name" property="projectName"/>
|
||||
<result column="registered_address" property="registeredAddress"/>
|
||||
<result column="legal_person" property="legalPerson"/>
|
||||
<result column="contact_phone" property="contactPhone"/>
|
||||
<result column="dept_id" property="deptId"/>
|
||||
<result column="dept_name" property="deptName"/>
|
||||
<result column="invoice_tax_rate" property="invoiceTaxRate"/>
|
||||
<result column="business_scope" property="businessScope"/>
|
||||
<result column="business_term_type" property="businessTermType"/>
|
||||
<result column="business_end_date" property="businessEndDate"/>
|
||||
<result column="registered_capital" property="registeredCapital"/>
|
||||
<result column="principal" property="principal"/>
|
||||
<result column="mnemonic_code" property="mnemonicCode"/>
|
||||
<result column="customer_level" property="customerLevel"/>
|
||||
<result column="max_credit_limit" property="maxCreditLimit"/>
|
||||
<result column="apply_credit_limit" property="applyCreditLimit"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="qualification_attachments" property="qualificationAttachments"/>
|
||||
<result column="access_type" property="accessType"/>
|
||||
<result column="approval_status" property="approvalStatus"/>
|
||||
<result column="current_node" property="currentNode"/>
|
||||
<result column="current_processor" property="currentProcessor"/>
|
||||
<result column="approved_time" property="approvedTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomerArchivePage" resultMap="customerArchiveResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
customer_code,
|
||||
short_name,
|
||||
full_name,
|
||||
customer_nature,
|
||||
unified_credit_code,
|
||||
customer_type,
|
||||
project_name,
|
||||
registered_address,
|
||||
legal_person,
|
||||
contact_phone,
|
||||
dept_id,
|
||||
dept_name,
|
||||
invoice_tax_rate,
|
||||
business_scope,
|
||||
business_term_type,
|
||||
business_end_date,
|
||||
registered_capital,
|
||||
principal,
|
||||
mnemonic_code,
|
||||
customer_level,
|
||||
max_credit_limit,
|
||||
apply_credit_limit,
|
||||
remark,
|
||||
qualification_attachments,
|
||||
access_type,
|
||||
approval_status,
|
||||
current_node,
|
||||
current_processor,
|
||||
approved_time
|
||||
FROM blade_customer_archive
|
||||
WHERE is_deleted = 0
|
||||
<if test="customer.customerCode != null and customer.customerCode != ''">
|
||||
<bind name="customerCodeLike" value="'%' + customer.customerCode + '%'"/>
|
||||
AND customer_code LIKE #{customerCodeLike}
|
||||
</if>
|
||||
<if test="customer.fullName != null and customer.fullName != ''">
|
||||
<bind name="fullNameLike" value="'%' + customer.fullName + '%'"/>
|
||||
AND full_name LIKE #{fullNameLike}
|
||||
</if>
|
||||
<if test="customer.shortName != null and customer.shortName != ''">
|
||||
<bind name="shortNameLike" value="'%' + customer.shortName + '%'"/>
|
||||
AND short_name LIKE #{shortNameLike}
|
||||
</if>
|
||||
<if test="customer.unifiedCreditCode != null and customer.unifiedCreditCode != ''">
|
||||
<bind name="creditCodeLike" value="'%' + customer.unifiedCreditCode + '%'"/>
|
||||
AND unified_credit_code LIKE #{creditCodeLike}
|
||||
</if>
|
||||
<if test="customer.customerNature != null and customer.customerNature != ''">
|
||||
AND customer_nature = #{customer.customerNature}
|
||||
</if>
|
||||
<if test="customer.customerType != null and customer.customerType != ''">
|
||||
<bind name="customerTypeLike" value="'%' + customer.customerType + '%'"/>
|
||||
AND customer_type LIKE #{customerTypeLike}
|
||||
</if>
|
||||
<if test="customer.accessType != null and customer.accessType != ''">
|
||||
AND access_type = #{customer.accessType}
|
||||
</if>
|
||||
<if test="customer.approvalStatus != null and customer.approvalStatus != ''">
|
||||
AND approval_status = #{customer.approvalStatus}
|
||||
</if>
|
||||
<if test="customer.status != null">
|
||||
AND status = #{customer.status}
|
||||
</if>
|
||||
<if test="customer.deptName != null and customer.deptName != ''">
|
||||
<bind name="deptNameLike" value="'%' + customer.deptName + '%'"/>
|
||||
AND dept_name LIKE #{deptNameLike}
|
||||
</if>
|
||||
<if test="customer.createTimeStart != null and customer.createTimeStart != ''">
|
||||
AND create_time >= #{customer.createTimeStart}
|
||||
</if>
|
||||
<if test="customer.createTimeEnd != null and customer.createTimeEnd != ''">
|
||||
AND create_time <= #{customer.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerChangeRecord;
|
||||
|
||||
/**
|
||||
* 客商变更记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerChangeRecordMapper extends BaseMapper<CustomerChangeRecord> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerContact;
|
||||
|
||||
/**
|
||||
* 客商联系人 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerContactMapper extends BaseMapper<CustomerContact> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerCreditScoreDetail;
|
||||
|
||||
/**
|
||||
* 客商评分明细 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerCreditScoreDetailMapper extends BaseMapper<CustomerCreditScoreDetail> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerCreditScore;
|
||||
|
||||
/**
|
||||
* 客商评分记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerCreditScoreMapper extends BaseMapper<CustomerCreditScore> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerInvoiceInfo;
|
||||
|
||||
/**
|
||||
* 客商发票信息 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerInvoiceInfoMapper extends BaseMapper<CustomerInvoiceInfo> {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.transport.pojo.entity.CustomerReceiptAccount;
|
||||
|
||||
/**
|
||||
* 客商收款信息 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface CustomerReceiptAccountMapper extends BaseMapper<CustomerReceiptAccount> {
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.Driver;
|
||||
import org.springblade.transport.pojo.vo.DriverExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.DriverVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机管理 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface DriverMapper extends BaseMapper<Driver> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param driver 查询参数
|
||||
* @return 司机分页
|
||||
*/
|
||||
List<DriverVO> selectDriverPage(IPage<DriverVO> page, @Param("driver") DriverVO driver);
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*
|
||||
* @param driver 查询参数
|
||||
* @return 统计信息
|
||||
*/
|
||||
DriverExpiryStatVO selectExpiryStat(@Param("driver") DriverVO driver);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?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="org.springblade.transport.mapper.DriverMapper">
|
||||
|
||||
<resultMap id="driverResultMap" type="org.springblade.transport.pojo.vo.DriverVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="driver_name" property="driverName"/>
|
||||
<result column="id_card_no" property="idCardNo"/>
|
||||
<result column="birthday" property="birthday"/>
|
||||
<result column="gender" property="gender"/>
|
||||
<result column="nation" property="nation"/>
|
||||
<result column="education" property="education"/>
|
||||
<result column="address_region" property="addressRegion"/>
|
||||
<result column="address" property="address"/>
|
||||
<result column="posts" property="posts"/>
|
||||
<result column="id_card_front" property="idCardFront"/>
|
||||
<result column="id_card_back" property="idCardBack"/>
|
||||
<result column="head_photo" property="headPhoto"/>
|
||||
<result column="driving_type" property="drivingType"/>
|
||||
<result column="driving_license_no" property="drivingLicenseNo"/>
|
||||
<result column="driving_license_start_date" property="drivingLicenseStartDate"/>
|
||||
<result column="driving_license_end_date" property="drivingLicenseEndDate"/>
|
||||
<result column="driving_license_long_term" property="drivingLicenseLongTerm"/>
|
||||
<result column="driving_license_front" property="drivingLicenseFront"/>
|
||||
<result column="driving_license_back" property="drivingLicenseBack"/>
|
||||
<result column="qualification_type" property="qualificationType"/>
|
||||
<result column="qualification_no" property="qualificationNo"/>
|
||||
<result column="qualification_end_date" property="qualificationEndDate"/>
|
||||
<result column="qualification_long_term" property="qualificationLongTerm"/>
|
||||
<result column="qualification_front" property="qualificationFront"/>
|
||||
<result column="qualification_back" property="qualificationBack"/>
|
||||
<result column="driver_type" property="driverType"/>
|
||||
<result column="mobile" property="mobile"/>
|
||||
<result column="contact_relation" property="contactRelation"/>
|
||||
<result column="organization_name" property="organizationName"/>
|
||||
<result column="emergency_contact_name" property="emergencyContactName"/>
|
||||
<result column="emergency_contact_mobile" property="emergencyContactMobile"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="BaseColumn">
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
driver_name,
|
||||
id_card_no,
|
||||
birthday,
|
||||
gender,
|
||||
nation,
|
||||
education,
|
||||
address_region,
|
||||
address,
|
||||
posts,
|
||||
id_card_front,
|
||||
id_card_back,
|
||||
head_photo,
|
||||
driving_type,
|
||||
driving_license_no,
|
||||
driving_license_start_date,
|
||||
driving_license_end_date,
|
||||
driving_license_long_term,
|
||||
driving_license_front,
|
||||
driving_license_back,
|
||||
qualification_type,
|
||||
qualification_no,
|
||||
qualification_end_date,
|
||||
qualification_long_term,
|
||||
qualification_front,
|
||||
qualification_back,
|
||||
driver_type,
|
||||
mobile,
|
||||
contact_relation,
|
||||
organization_name,
|
||||
emergency_contact_name,
|
||||
emergency_contact_mobile,
|
||||
remark
|
||||
</sql>
|
||||
|
||||
<sql id="QueryCondition">
|
||||
is_deleted = 0
|
||||
<if test="driver.driverName != null and driver.driverName != ''">
|
||||
<bind name="driverNameLike" value="'%' + driver.driverName + '%'"/>
|
||||
AND driver_name LIKE #{driverNameLike}
|
||||
</if>
|
||||
<if test="driver.mobile != null and driver.mobile != ''">
|
||||
<bind name="mobileLike" value="'%' + driver.mobile + '%'"/>
|
||||
AND mobile LIKE #{mobileLike}
|
||||
</if>
|
||||
<if test="driver.idCardNo != null and driver.idCardNo != ''">
|
||||
<bind name="idCardNoLike" value="'%' + driver.idCardNo + '%'"/>
|
||||
AND id_card_no LIKE #{idCardNoLike}
|
||||
</if>
|
||||
<if test="driver.drivingType != null and driver.drivingType != ''">
|
||||
AND driving_type = #{driver.drivingType}
|
||||
</if>
|
||||
<if test="driver.driverType != null and driver.driverType != ''">
|
||||
AND driver_type = #{driver.driverType}
|
||||
</if>
|
||||
<if test="driver.organizationName != null and driver.organizationName != ''">
|
||||
<bind name="organizationNameLike" value="'%' + driver.organizationName + '%'"/>
|
||||
AND organization_name LIKE #{organizationNameLike}
|
||||
</if>
|
||||
<if test="driver.status != null">
|
||||
AND status = #{driver.status}
|
||||
</if>
|
||||
<if test="driver.expireStatus != null and driver.expireStatus == 'within30'">
|
||||
AND (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
)
|
||||
</if>
|
||||
<if test="driver.expireStatus != null and driver.expireStatus == 'expired'">
|
||||
AND (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date < #{driver.today})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date < #{driver.today})
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectDriverPage" resultMap="driverResultMap">
|
||||
SELECT
|
||||
<include refid="BaseColumn"/>
|
||||
FROM
|
||||
blade_transport_driver
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectExpiryStat" resultType="org.springblade.transport.pojo.vo.DriverExpiryStatVO">
|
||||
SELECT
|
||||
COUNT(1) AS total,
|
||||
SUM(CASE WHEN (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
) THEN 1 ELSE 0 END) AS within30,
|
||||
SUM(CASE WHEN (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date < #{driver.today})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date < #{driver.today})
|
||||
) THEN 1 ELSE 0 END) AS expired
|
||||
FROM
|
||||
blade_transport_driver
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.EtcRecord;
|
||||
import org.springblade.transport.pojo.vo.EtcRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ETC记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface EtcRecordMapper extends BaseMapper<EtcRecord> {
|
||||
|
||||
List<EtcRecordVO> selectEtcRecordPage(IPage<EtcRecordVO> page, EtcRecordVO etcRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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="org.springblade.transport.mapper.EtcRecordMapper">
|
||||
|
||||
<resultMap id="etcRecordResultMap" type="org.springblade.transport.pojo.vo.EtcRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="etc_card_no" property="etcCardNo"/>
|
||||
<result column="entry_time" property="entryTime"/>
|
||||
<result column="exit_time" property="exitTime"/>
|
||||
<result column="entry_station" property="entryStation"/>
|
||||
<result column="exit_station" property="exitStation"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
<result column="transaction_amount" property="transactionAmount"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectEtcRecordPage" resultMap="etcRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_no,
|
||||
etc_card_no,
|
||||
entry_time,
|
||||
exit_time,
|
||||
entry_station,
|
||||
exit_station,
|
||||
data_source,
|
||||
CASE WHEN transaction_amount < 0 THEN 0 ELSE transaction_amount END AS transaction_amount,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_etc_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="etcRecord.createDept != null">
|
||||
AND create_dept = #{etcRecord.createDept}
|
||||
</if>
|
||||
<if test="etcRecord.vehicleNo != null and etcRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + etcRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="etcRecord.etcCardNo != null and etcRecord.etcCardNo != ''">
|
||||
<bind name="etcCardNoLike" value="'%' + etcRecord.etcCardNo + '%'"/>
|
||||
AND etc_card_no LIKE #{etcCardNoLike}
|
||||
</if>
|
||||
ORDER BY exit_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.InsuranceRecord;
|
||||
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保险记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface InsuranceRecordMapper extends BaseMapper<InsuranceRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param insuranceRecord 查询参数
|
||||
* @return 保险记录列表
|
||||
*/
|
||||
List<InsuranceRecordVO> selectInsuranceRecordPage(IPage<InsuranceRecordVO> page, @Param("insuranceRecord") InsuranceRecordVO insuranceRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?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="org.springblade.transport.mapper.InsuranceRecordMapper">
|
||||
|
||||
<resultMap id="insuranceRecordResultMap" type="org.springblade.transport.pojo.vo.InsuranceRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="insurance_type" property="insuranceType"/>
|
||||
<result column="policy_no" property="policyNo"/>
|
||||
<result column="start_date" property="startDate"/>
|
||||
<result column="end_date" property="endDate"/>
|
||||
<result column="insured_amount" property="insuredAmount"/>
|
||||
<result column="premium" property="premium"/>
|
||||
<result column="invoice_no" property="invoiceNo"/>
|
||||
<result column="invoice_date" property="invoiceDate"/>
|
||||
<result column="ocr_template" property="ocrTemplate"/>
|
||||
<result column="policy_file" property="policyFile"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectInsuranceRecordPage" resultMap="insuranceRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
insurance_type,
|
||||
policy_no,
|
||||
start_date,
|
||||
end_date,
|
||||
CASE WHEN insured_amount < 0 THEN 0 ELSE insured_amount END AS insured_amount,
|
||||
CASE WHEN premium < 0 THEN 0 ELSE premium END AS premium,
|
||||
invoice_no,
|
||||
invoice_date,
|
||||
ocr_template,
|
||||
policy_file,
|
||||
remark
|
||||
FROM
|
||||
blade_insurance_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="insuranceRecord.createDept != null">
|
||||
AND create_dept = #{insuranceRecord.createDept}
|
||||
</if>
|
||||
<if test="insuranceRecord.vehicleType != null and insuranceRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{insuranceRecord.vehicleType}
|
||||
</if>
|
||||
<if test="insuranceRecord.vehicleNo != null and insuranceRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + insuranceRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="insuranceRecord.insuranceType != null and insuranceRecord.insuranceType != ''">
|
||||
AND insurance_type = #{insuranceRecord.insuranceType}
|
||||
</if>
|
||||
<if test="insuranceRecord.createTimeStart != null and insuranceRecord.createTimeStart != ''">
|
||||
AND create_time >= #{insuranceRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="insuranceRecord.createTimeEnd != null and insuranceRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{insuranceRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.MileageRecord;
|
||||
import org.springblade.transport.pojo.vo.MileageRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 里程记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface MileageRecordMapper extends BaseMapper<MileageRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param mileageRecord 查询参数
|
||||
* @return 里程记录分页
|
||||
*/
|
||||
List<MileageRecordVO> selectMileageRecordPage(IPage<MileageRecordVO> page, MileageRecordVO mileageRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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="org.springblade.transport.mapper.MileageRecordMapper">
|
||||
|
||||
<resultMap id="mileageRecordResultMap" type="org.springblade.transport.pojo.vo.MileageRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="previous_month_mileage" property="previousMonthMileage"/>
|
||||
<result column="current_month_mileage" property="currentMonthMileage"/>
|
||||
<result column="monthly_mileage" property="monthlyMileage"/>
|
||||
<result column="total_mileage" property="totalMileage"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMileageRecordPage" resultMap="mileageRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_no,
|
||||
CASE WHEN previous_month_mileage < 0 THEN 0 ELSE previous_month_mileage END AS previous_month_mileage,
|
||||
CASE WHEN current_month_mileage < 0 THEN 0 ELSE current_month_mileage END AS current_month_mileage,
|
||||
CASE WHEN monthly_mileage < 0 THEN 0 ELSE monthly_mileage END AS monthly_mileage,
|
||||
CASE WHEN total_mileage < 0 THEN 0 ELSE total_mileage END AS total_mileage,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_mileage_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="mileageRecord.createDept != null">
|
||||
AND create_dept = #{mileageRecord.createDept}
|
||||
</if>
|
||||
<if test="mileageRecord.vehicleNo != null and mileageRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + mileageRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="mileageRecord.totalMileageStart != null">
|
||||
AND total_mileage >= #{mileageRecord.totalMileageStart}
|
||||
</if>
|
||||
<if test="mileageRecord.totalMileageEnd != null">
|
||||
AND total_mileage <= #{mileageRecord.totalMileageEnd}
|
||||
</if>
|
||||
<if test="mileageRecord.createTimeStart != null and mileageRecord.createTimeStart != ''">
|
||||
AND create_time >= #{mileageRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="mileageRecord.createTimeEnd != null and mileageRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{mileageRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.OilElectricRecord;
|
||||
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 油电记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface OilElectricRecordMapper extends BaseMapper<OilElectricRecord> {
|
||||
|
||||
List<OilElectricRecordVO> selectOilElectricRecordPage(IPage<OilElectricRecordVO> page, OilElectricRecordVO oilElectricRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?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="org.springblade.transport.mapper.OilElectricRecordMapper">
|
||||
|
||||
<resultMap id="oilElectricRecordResultMap" type="org.springblade.transport.pojo.vo.OilElectricRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="card_no" property="cardNo"/>
|
||||
<result column="transaction_time" property="transactionTime"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="fee_type" property="feeType"/>
|
||||
<result column="oil_product" property="oilProduct"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="card_holder" property="cardHolder"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="unit_price" property="unitPrice"/>
|
||||
<result column="transaction_amount" property="transactionAmount"/>
|
||||
<result column="balance" property="balance"/>
|
||||
<result column="station" property="station"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOilElectricRecordPage" resultMap="oilElectricRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
card_no,
|
||||
transaction_time,
|
||||
vehicle_type,
|
||||
fee_type,
|
||||
oil_product,
|
||||
vehicle_no,
|
||||
card_holder,
|
||||
data_source,
|
||||
CASE WHEN quantity < 0 THEN 0 ELSE quantity END AS quantity,
|
||||
CASE WHEN unit_price < 0 THEN 0 ELSE unit_price END AS unit_price,
|
||||
CASE WHEN transaction_amount < 0 THEN 0 ELSE transaction_amount END AS transaction_amount,
|
||||
CASE WHEN balance < 0 THEN 0 ELSE balance END AS balance,
|
||||
station,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_oil_electric_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="oilElectricRecord.createDept != null">
|
||||
AND create_dept = #{oilElectricRecord.createDept}
|
||||
</if>
|
||||
<if test="oilElectricRecord.vehicleType != null and oilElectricRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{oilElectricRecord.vehicleType}
|
||||
</if>
|
||||
<if test="oilElectricRecord.feeType != null and oilElectricRecord.feeType != ''">
|
||||
AND fee_type = #{oilElectricRecord.feeType}
|
||||
</if>
|
||||
<if test="oilElectricRecord.vehicleNo != null and oilElectricRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + oilElectricRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="oilElectricRecord.transactionTimeStart != null">
|
||||
AND transaction_time >= #{oilElectricRecord.transactionTimeStart}
|
||||
</if>
|
||||
<if test="oilElectricRecord.transactionTimeEnd != null">
|
||||
AND transaction_time <= #{oilElectricRecord.transactionTimeEnd}
|
||||
</if>
|
||||
<if test="oilElectricRecord.transactionAmountStart != null">
|
||||
AND transaction_amount >= #{oilElectricRecord.transactionAmountStart}
|
||||
</if>
|
||||
<if test="oilElectricRecord.transactionAmountEnd != null">
|
||||
AND transaction_amount <= #{oilElectricRecord.transactionAmountEnd}
|
||||
</if>
|
||||
<if test="oilElectricRecord.createTimeStart != null and oilElectricRecord.createTimeStart != ''">
|
||||
AND create_time >= #{oilElectricRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="oilElectricRecord.createTimeEnd != null and oilElectricRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{oilElectricRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY transaction_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
|
||||
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 其他费用记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface OtherExpenseRecordMapper extends BaseMapper<OtherExpenseRecord> {
|
||||
|
||||
List<OtherExpenseRecordVO> selectOtherExpenseRecordPage(IPage<OtherExpenseRecordVO> page, OtherExpenseRecordVO otherExpenseRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?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="org.springblade.transport.mapper.OtherExpenseRecordMapper">
|
||||
|
||||
<resultMap id="otherExpenseRecordResultMap" type="org.springblade.transport.pojo.vo.OtherExpenseRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="expense_date" property="expenseDate"/>
|
||||
<result column="expense_type" property="expenseType"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
<result column="amount" property="amount"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOtherExpenseRecordPage" resultMap="otherExpenseRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
expense_date,
|
||||
expense_type,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
data_source,
|
||||
CASE WHEN amount < 0 THEN 0 ELSE amount END AS amount,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_other_expense_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="otherExpenseRecord.createDept != null">
|
||||
AND create_dept = #{otherExpenseRecord.createDept}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.expenseType != null and otherExpenseRecord.expenseType != ''">
|
||||
AND expense_type = #{otherExpenseRecord.expenseType}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.vehicleType != null and otherExpenseRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{otherExpenseRecord.vehicleType}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.vehicleNo != null and otherExpenseRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + otherExpenseRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.expenseDateStart != null">
|
||||
AND expense_date >= #{otherExpenseRecord.expenseDateStart}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.expenseDateEnd != null">
|
||||
AND expense_date <= #{otherExpenseRecord.expenseDateEnd}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.createTimeStart != null and otherExpenseRecord.createTimeStart != ''">
|
||||
AND create_time >= #{otherExpenseRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="otherExpenseRecord.createTimeEnd != null and otherExpenseRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{otherExpenseRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY expense_date DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.TireReplacementRecord;
|
||||
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 换胎记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface TireReplacementRecordMapper extends BaseMapper<TireReplacementRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param tireReplacementRecord 查询参数
|
||||
* @return 换胎记录分页
|
||||
*/
|
||||
List<TireReplacementRecordVO> selectTireReplacementRecordPage(IPage<TireReplacementRecordVO> page, TireReplacementRecordVO tireReplacementRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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="org.springblade.transport.mapper.TireReplacementRecordMapper">
|
||||
|
||||
<resultMap id="tireReplacementRecordResultMap" type="org.springblade.transport.pojo.vo.TireReplacementRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="handler" property="handler"/>
|
||||
<result column="replacement_time" property="replacementTime"/>
|
||||
<result column="tire_brand" property="tireBrand"/>
|
||||
<result column="tire_quantity" property="tireQuantity"/>
|
||||
<result column="replacement_cost" property="replacementCost"/>
|
||||
<result column="replacement_description" property="replacementDescription"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTireReplacementRecordPage" resultMap="tireReplacementRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_no,
|
||||
handler,
|
||||
replacement_time,
|
||||
tire_brand,
|
||||
CASE WHEN tire_quantity < 0 THEN 0 ELSE tire_quantity END AS tire_quantity,
|
||||
CASE WHEN replacement_cost < 0 THEN 0 ELSE replacement_cost END AS replacement_cost,
|
||||
replacement_description,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_tire_replacement_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="tireReplacementRecord.createDept != null">
|
||||
AND create_dept = #{tireReplacementRecord.createDept}
|
||||
</if>
|
||||
<if test="tireReplacementRecord.vehicleNo != null and tireReplacementRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + tireReplacementRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="tireReplacementRecord.createTimeStart != null and tireReplacementRecord.createTimeStart != ''">
|
||||
AND create_time >= #{tireReplacementRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="tireReplacementRecord.createTimeEnd != null and tireReplacementRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{tireReplacementRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.transport.pojo.entity.TransportChangeRecord;
|
||||
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 变更记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface TransportChangeRecordMapper extends BaseMapper<TransportChangeRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param transportChangeRecord 查询参数
|
||||
* @return 变更记录分页
|
||||
*/
|
||||
List<TransportChangeRecordVO> selectTransportChangeRecordPage(IPage<TransportChangeRecordVO> page, TransportChangeRecordVO transportChangeRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?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="org.springblade.transport.mapper.TransportChangeRecordMapper">
|
||||
|
||||
<resultMap id="transportChangeRecordResultMap" type="org.springblade.transport.pojo.vo.TransportChangeRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="change_item" property="changeItem"/>
|
||||
<result column="change_content" property="changeContent"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTransportChangeRecordPage" resultMap="transportChangeRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
change_item,
|
||||
change_content,
|
||||
attachments,
|
||||
remark
|
||||
FROM
|
||||
blade_transport_change_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="transportChangeRecord.createDept != null">
|
||||
AND create_dept = #{transportChangeRecord.createDept}
|
||||
</if>
|
||||
<if test="transportChangeRecord.vehicleType != null and transportChangeRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{transportChangeRecord.vehicleType}
|
||||
</if>
|
||||
<if test="transportChangeRecord.vehicleNo != null and transportChangeRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + transportChangeRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="transportChangeRecord.changeContent != null and transportChangeRecord.changeContent != ''">
|
||||
<bind name="changeContentLike" value="'%' + transportChangeRecord.changeContent + '%'"/>
|
||||
AND change_content LIKE #{changeContentLike}
|
||||
</if>
|
||||
<if test="transportChangeRecord.createTimeStart != null and transportChangeRecord.createTimeStart != ''">
|
||||
AND create_time >= #{transportChangeRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="transportChangeRecord.createTimeEnd != null and transportChangeRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{transportChangeRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.TransportShip;
|
||||
import org.springblade.transport.pojo.vo.TransportShipExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportShipVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 船舶管理 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface TransportShipMapper extends BaseMapper<TransportShip> {
|
||||
|
||||
List<TransportShipVO> selectTransportShipPage(IPage<TransportShipVO> page, @Param("ship") TransportShipVO ship);
|
||||
|
||||
TransportShipExpiryStatVO selectExpiryStat(@Param("ship") TransportShipVO ship);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?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="org.springblade.transport.mapper.TransportShipMapper">
|
||||
|
||||
<resultMap id="transportShipResultMap" type="org.springblade.transport.pojo.vo.TransportShipVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="ship_name" property="shipName"/>
|
||||
<result column="ship_identifier_no" property="shipIdentifierNo"/>
|
||||
<result column="organization_name" property="organizationName"/>
|
||||
<result column="ship_inspection_no" property="shipInspectionNo"/>
|
||||
<result column="ship_type" property="shipType"/>
|
||||
<result column="nationality_cert_end_date" property="nationalityCertEndDate"/>
|
||||
<result column="nationality_cert_long_term" property="nationalityCertLongTerm"/>
|
||||
<result column="nationality_cert_image" property="nationalityCertImage"/>
|
||||
<result column="safe_manning_cert_end_date" property="safeManningCertEndDate"/>
|
||||
<result column="safe_manning_cert_long_term" property="safeManningCertLongTerm"/>
|
||||
<result column="safe_manning_cert_image" property="safeManningCertImage"/>
|
||||
<result column="business_transport_cert_end_date" property="businessTransportCertEndDate"/>
|
||||
<result column="business_transport_cert_long_term" property="businessTransportCertLongTerm"/>
|
||||
<result column="business_transport_cert_image" property="businessTransportCertImage"/>
|
||||
<result column="lease_end_date" property="leaseEndDate"/>
|
||||
<result column="lease_long_term" property="leaseLongTerm"/>
|
||||
<result column="lease_contract_image" property="leaseContractImage"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="BaseColumn">
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
ship_name,
|
||||
ship_identifier_no,
|
||||
organization_name,
|
||||
ship_inspection_no,
|
||||
ship_type,
|
||||
nationality_cert_end_date,
|
||||
nationality_cert_long_term,
|
||||
nationality_cert_image,
|
||||
safe_manning_cert_end_date,
|
||||
safe_manning_cert_long_term,
|
||||
safe_manning_cert_image,
|
||||
business_transport_cert_end_date,
|
||||
business_transport_cert_long_term,
|
||||
business_transport_cert_image,
|
||||
lease_end_date,
|
||||
lease_long_term,
|
||||
lease_contract_image,
|
||||
remark
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryWithin30Condition">
|
||||
(
|
||||
(nationality_cert_long_term != 1 AND nationality_cert_end_date BETWEEN #{ship.today} AND #{ship.warningDate})
|
||||
OR (safe_manning_cert_long_term != 1 AND safe_manning_cert_end_date BETWEEN #{ship.today} AND #{ship.warningDate})
|
||||
OR (business_transport_cert_long_term != 1 AND business_transport_cert_end_date BETWEEN #{ship.today} AND #{ship.warningDate})
|
||||
OR (lease_long_term != 1 AND lease_end_date BETWEEN #{ship.today} AND #{ship.warningDate})
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryExpiredCondition">
|
||||
(
|
||||
(nationality_cert_long_term != 1 AND nationality_cert_end_date < #{ship.today})
|
||||
OR (safe_manning_cert_long_term != 1 AND safe_manning_cert_end_date < #{ship.today})
|
||||
OR (business_transport_cert_long_term != 1 AND business_transport_cert_end_date < #{ship.today})
|
||||
OR (lease_long_term != 1 AND lease_end_date < #{ship.today})
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="QueryCondition">
|
||||
is_deleted = 0
|
||||
<if test="ship.shipName != null and ship.shipName != ''">
|
||||
<bind name="shipNameLike" value="'%' + ship.shipName + '%'"/>
|
||||
AND ship_name LIKE #{shipNameLike}
|
||||
</if>
|
||||
<if test="ship.shipIdentifierNo != null and ship.shipIdentifierNo != ''">
|
||||
<bind name="shipIdentifierNoLike" value="'%' + ship.shipIdentifierNo + '%'"/>
|
||||
AND ship_identifier_no LIKE #{shipIdentifierNoLike}
|
||||
</if>
|
||||
<if test="ship.organizationName != null and ship.organizationName != ''">
|
||||
<bind name="organizationNameLike" value="'%' + ship.organizationName + '%'"/>
|
||||
AND organization_name LIKE #{organizationNameLike}
|
||||
</if>
|
||||
<if test="ship.shipInspectionNo != null and ship.shipInspectionNo != ''">
|
||||
<bind name="shipInspectionNoLike" value="'%' + ship.shipInspectionNo + '%'"/>
|
||||
AND ship_inspection_no LIKE #{shipInspectionNoLike}
|
||||
</if>
|
||||
<if test="ship.shipType != null and ship.shipType != ''">
|
||||
AND ship_type = #{ship.shipType}
|
||||
</if>
|
||||
<if test="ship.status != null">
|
||||
AND status = #{ship.status}
|
||||
</if>
|
||||
<if test="ship.expireStatus != null and ship.expireStatus == 'within30'">
|
||||
AND <include refid="ExpiryWithin30Condition"/>
|
||||
</if>
|
||||
<if test="ship.expireStatus != null and ship.expireStatus == 'expired'">
|
||||
AND <include refid="ExpiryExpiredCondition"/>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectTransportShipPage" resultMap="transportShipResultMap">
|
||||
SELECT
|
||||
<include refid="BaseColumn"/>
|
||||
FROM
|
||||
blade_transport_ship
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectExpiryStat" resultType="org.springblade.transport.pojo.vo.TransportShipExpiryStatVO">
|
||||
SELECT
|
||||
COUNT(1) AS total,
|
||||
SUM(CASE WHEN <include refid="ExpiryWithin30Condition"/> THEN 1 ELSE 0 END) AS within30,
|
||||
SUM(CASE WHEN <include refid="ExpiryExpiredCondition"/> THEN 1 ELSE 0 END) AS expired
|
||||
FROM
|
||||
blade_transport_ship
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.TransportVehicle;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆管理 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface TransportVehicleMapper extends BaseMapper<TransportVehicle> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param vehicle 查询参数
|
||||
* @return 车辆列表
|
||||
*/
|
||||
List<TransportVehicleVO> selectTransportVehiclePage(IPage<TransportVehicleVO> page, @Param("vehicle") TransportVehicleVO vehicle);
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*
|
||||
* @param vehicle 查询参数
|
||||
* @return 统计信息
|
||||
*/
|
||||
TransportVehicleExpiryStatVO selectExpiryStat(@Param("vehicle") TransportVehicleVO vehicle);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?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="org.springblade.transport.mapper.TransportVehicleMapper">
|
||||
|
||||
<resultMap id="transportVehicleResultMap" type="org.springblade.transport.pojo.vo.TransportVehicleVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="organization_name" property="organizationName"/>
|
||||
<result column="plate_no" property="plateNo"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="outer_length" property="outerLength"/>
|
||||
<result column="outer_width" property="outerWidth"/>
|
||||
<result column="outer_height" property="outerHeight"/>
|
||||
<result column="approved_load_kg" property="approvedLoadKg"/>
|
||||
<result column="traction_mass_kg" property="tractionMassKg"/>
|
||||
<result column="business_relation" property="businessRelation"/>
|
||||
<result column="energy_type" property="energyType"/>
|
||||
<result column="compulsory_scrap_date" property="compulsoryScrapDate"/>
|
||||
<result column="compulsory_scrap_long_term" property="compulsoryScrapLongTerm"/>
|
||||
<result column="customs_record_no" property="customsRecordNo"/>
|
||||
<result column="driving_license_no" property="drivingLicenseNo"/>
|
||||
<result column="driving_license_start_date" property="drivingLicenseStartDate"/>
|
||||
<result column="driving_license_end_date" property="drivingLicenseEndDate"/>
|
||||
<result column="driving_license_long_term" property="drivingLicenseLongTerm"/>
|
||||
<result column="driving_license_image" property="drivingLicenseImage"/>
|
||||
<result column="road_transport_cert_no" property="roadTransportCertNo"/>
|
||||
<result column="road_transport_cert_start_date" property="roadTransportCertStartDate"/>
|
||||
<result column="road_transport_cert_end_date" property="roadTransportCertEndDate"/>
|
||||
<result column="road_transport_cert_long_term" property="roadTransportCertLongTerm"/>
|
||||
<result column="road_transport_cert_image" property="roadTransportCertImage"/>
|
||||
<result column="annual_review_end_date" property="annualReviewEndDate"/>
|
||||
<result column="annual_review_long_term" property="annualReviewLongTerm"/>
|
||||
<result column="registration_no" property="registrationNo"/>
|
||||
<result column="registration_date" property="registrationDate"/>
|
||||
<result column="registration_image" property="registrationImage"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="BaseColumn">
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
organization_name,
|
||||
plate_no,
|
||||
vehicle_type,
|
||||
outer_length,
|
||||
outer_width,
|
||||
outer_height,
|
||||
approved_load_kg,
|
||||
traction_mass_kg,
|
||||
business_relation,
|
||||
energy_type,
|
||||
compulsory_scrap_date,
|
||||
compulsory_scrap_long_term,
|
||||
customs_record_no,
|
||||
driving_license_no,
|
||||
driving_license_start_date,
|
||||
driving_license_end_date,
|
||||
driving_license_long_term,
|
||||
driving_license_image,
|
||||
road_transport_cert_no,
|
||||
road_transport_cert_start_date,
|
||||
road_transport_cert_end_date,
|
||||
road_transport_cert_long_term,
|
||||
road_transport_cert_image,
|
||||
annual_review_end_date,
|
||||
annual_review_long_term,
|
||||
registration_no,
|
||||
registration_date,
|
||||
registration_image,
|
||||
remark
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryWithin30Condition">
|
||||
(
|
||||
(compulsory_scrap_long_term != 1 AND compulsory_scrap_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
|
||||
OR (driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
|
||||
OR (road_transport_cert_long_term != 1 AND road_transport_cert_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
|
||||
OR (annual_review_long_term != 1 AND annual_review_end_date BETWEEN #{vehicle.today} AND #{vehicle.warningDate})
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryExpiredCondition">
|
||||
(
|
||||
(compulsory_scrap_long_term != 1 AND compulsory_scrap_date < #{vehicle.today})
|
||||
OR (driving_license_long_term != 1 AND driving_license_end_date < #{vehicle.today})
|
||||
OR (road_transport_cert_long_term != 1 AND road_transport_cert_end_date < #{vehicle.today})
|
||||
OR (annual_review_long_term != 1 AND annual_review_end_date < #{vehicle.today})
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="QueryCondition">
|
||||
is_deleted = 0
|
||||
<if test="vehicle.organizationName != null and vehicle.organizationName != ''">
|
||||
<bind name="organizationNameLike" value="'%' + vehicle.organizationName + '%'"/>
|
||||
AND organization_name LIKE #{organizationNameLike}
|
||||
</if>
|
||||
<if test="vehicle.plateNo != null and vehicle.plateNo != ''">
|
||||
<bind name="plateNoLike" value="'%' + vehicle.plateNo + '%'"/>
|
||||
AND plate_no LIKE #{plateNoLike}
|
||||
</if>
|
||||
<if test="vehicle.vehicleType != null and vehicle.vehicleType != ''">
|
||||
AND vehicle_type = #{vehicle.vehicleType}
|
||||
</if>
|
||||
<if test="vehicle.businessRelation != null and vehicle.businessRelation != ''">
|
||||
AND business_relation = #{vehicle.businessRelation}
|
||||
</if>
|
||||
<if test="vehicle.energyType != null and vehicle.energyType != ''">
|
||||
AND energy_type = #{vehicle.energyType}
|
||||
</if>
|
||||
<if test="vehicle.status != null">
|
||||
AND status = #{vehicle.status}
|
||||
</if>
|
||||
<if test="vehicle.expireStatus != null and vehicle.expireStatus == 'within30'">
|
||||
AND <include refid="ExpiryWithin30Condition"/>
|
||||
</if>
|
||||
<if test="vehicle.expireStatus != null and vehicle.expireStatus == 'expired'">
|
||||
AND <include refid="ExpiryExpiredCondition"/>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectTransportVehiclePage" resultMap="transportVehicleResultMap">
|
||||
SELECT
|
||||
<include refid="BaseColumn"/>
|
||||
FROM
|
||||
blade_transport_vehicle
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectExpiryStat" resultType="org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO">
|
||||
SELECT
|
||||
COUNT(1) AS total,
|
||||
SUM(CASE WHEN <include refid="ExpiryWithin30Condition"/> THEN 1 ELSE 0 END) AS within30,
|
||||
SUM(CASE WHEN <include refid="ExpiryExpiredCondition"/> THEN 1 ELSE 0 END) AS expired
|
||||
FROM
|
||||
blade_transport_vehicle
|
||||
WHERE
|
||||
<include refid="QueryCondition"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springblade.transport.pojo.entity.ViolationRecord;
|
||||
import org.springblade.transport.pojo.vo.ViolationRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违章记录 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ViolationRecordMapper extends BaseMapper<ViolationRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param violationRecord 查询参数
|
||||
* @return 违章记录列表
|
||||
*/
|
||||
List<ViolationRecordVO> selectViolationRecordPage(IPage<ViolationRecordVO> page, @Param("violationRecord") ViolationRecordVO violationRecord);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?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="org.springblade.transport.mapper.ViolationRecordMapper">
|
||||
|
||||
<resultMap id="violationRecordResultMap" type="org.springblade.transport.pojo.vo.ViolationRecordVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="vehicle_no" property="vehicleNo"/>
|
||||
<result column="driver_name" property="driverName"/>
|
||||
<result column="violation_type" property="violationType"/>
|
||||
<result column="violation_item" property="violationItem"/>
|
||||
<result column="violation_time" property="violationTime"/>
|
||||
<result column="location" property="location"/>
|
||||
<result column="fine_amount" property="fineAmount"/>
|
||||
<result column="deduct_points" property="deductPoints"/>
|
||||
<result column="penalty_unit" property="penaltyUnit"/>
|
||||
<result column="process_status" property="processStatus"/>
|
||||
<result column="process_description" property="processDescription"/>
|
||||
<result column="process_result" property="processResult"/>
|
||||
<result column="attachments" property="attachments"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectViolationRecordPage" resultMap="violationRecordResultMap">
|
||||
SELECT
|
||||
id,
|
||||
tenant_id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
vehicle_type,
|
||||
vehicle_no,
|
||||
driver_name,
|
||||
violation_type,
|
||||
violation_item,
|
||||
violation_time,
|
||||
location,
|
||||
CASE WHEN fine_amount < 0 THEN 0 ELSE fine_amount END AS fine_amount,
|
||||
CASE WHEN deduct_points < 0 THEN 0 ELSE deduct_points END AS deduct_points,
|
||||
penalty_unit,
|
||||
process_status,
|
||||
process_description,
|
||||
process_result,
|
||||
attachments
|
||||
FROM
|
||||
blade_violation_record
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
<if test="violationRecord.createDept != null">
|
||||
AND create_dept = #{violationRecord.createDept}
|
||||
</if>
|
||||
<if test="violationRecord.vehicleType != null and violationRecord.vehicleType != ''">
|
||||
AND vehicle_type = #{violationRecord.vehicleType}
|
||||
</if>
|
||||
<if test="violationRecord.vehicleNo != null and violationRecord.vehicleNo != ''">
|
||||
<bind name="vehicleNoLike" value="'%' + violationRecord.vehicleNo + '%'"/>
|
||||
AND vehicle_no LIKE #{vehicleNoLike}
|
||||
</if>
|
||||
<if test="violationRecord.driverName != null and violationRecord.driverName != ''">
|
||||
<bind name="driverNameLike" value="'%' + violationRecord.driverName + '%'"/>
|
||||
AND driver_name LIKE #{driverNameLike}
|
||||
</if>
|
||||
<if test="violationRecord.processStatus != null and violationRecord.processStatus != ''">
|
||||
AND process_status = #{violationRecord.processStatus}
|
||||
</if>
|
||||
<if test="violationRecord.createTimeStart != null and violationRecord.createTimeStart != ''">
|
||||
AND create_time >= #{violationRecord.createTimeStart}
|
||||
</if>
|
||||
<if test="violationRecord.createTimeEnd != null and violationRecord.createTimeEnd != ''">
|
||||
AND create_time <= #{violationRecord.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.AccidentRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.AccidentRecord;
|
||||
import org.springblade.transport.pojo.vo.AccidentRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IAccidentRecordService extends BaseService<AccidentRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param accidentRecord 查询参数
|
||||
* @return 事故记录分页
|
||||
*/
|
||||
IPage<AccidentRecordVO> selectAccidentRecordPage(IPage<AccidentRecordVO> page, AccidentRecordVO accidentRecord);
|
||||
|
||||
/**
|
||||
* 新增或修改事故记录
|
||||
*
|
||||
* @param accidentRecord 事故记录
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(AccidentRecord accidentRecord);
|
||||
|
||||
/**
|
||||
* 导入事故记录
|
||||
*
|
||||
* @param data 导入数据
|
||||
*/
|
||||
void importAccidentRecord(List<AccidentRecordExcel> data);
|
||||
|
||||
/**
|
||||
* 导出事故记录
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<AccidentRecordExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
|
||||
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 年检记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IAnnualInspectionRecordService extends BaseService<AnnualInspectionRecord> {
|
||||
|
||||
IPage<AnnualInspectionRecordVO> selectAnnualInspectionRecordPage(IPage<AnnualInspectionRecordVO> page, AnnualInspectionRecordVO annualInspectionRecord);
|
||||
|
||||
boolean submit(AnnualInspectionRecord annualInspectionRecord);
|
||||
|
||||
void importAnnualInspectionRecord(List<AnnualInspectionRecordExcel> data);
|
||||
|
||||
List<AnnualInspectionRecordExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.CustomerArchiveExcel;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerCreditScoreVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客商档案 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ICustomerArchiveService extends BaseService<CustomerArchive> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param customer 查询参数
|
||||
* @return 客商档案分页
|
||||
*/
|
||||
IPage<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page, CustomerArchiveVO customer);
|
||||
|
||||
/**
|
||||
* 聚合详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 客商档案详情
|
||||
*/
|
||||
CustomerArchiveVO detail(Long id);
|
||||
|
||||
/**
|
||||
* 新增或修改客商档案
|
||||
*
|
||||
* @param customer 客商档案
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(CustomerArchiveVO customer);
|
||||
|
||||
/**
|
||||
* 提交审核
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submitApproval(Long id);
|
||||
|
||||
/**
|
||||
* 审核通过
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean approve(Long id);
|
||||
|
||||
/**
|
||||
* 审核驳回
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean reject(Long id);
|
||||
|
||||
/**
|
||||
* 启用或停用
|
||||
*
|
||||
* @param id 主键
|
||||
* @param status 状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean changeStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 删除草稿客商
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean removeDraft(String ids);
|
||||
|
||||
/**
|
||||
* 基于启用评分量化表生成评分记录
|
||||
*
|
||||
* @param quantificationId 评分量化表ID
|
||||
* @return 评分记录
|
||||
*/
|
||||
CustomerCreditScoreVO buildScoreTemplate(Long quantificationId);
|
||||
|
||||
/**
|
||||
* 导出客商档案
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<CustomerArchiveExcel> exportCustomerArchive(Wrapper<CustomerArchive> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.DriverExcel;
|
||||
import org.springblade.transport.pojo.entity.Driver;
|
||||
import org.springblade.transport.pojo.vo.DriverExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.DriverVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机管理 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IDriverService extends BaseService<Driver> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param driver 查询参数
|
||||
* @return 司机分页
|
||||
*/
|
||||
IPage<DriverVO> selectDriverPage(IPage<DriverVO> page, DriverVO driver);
|
||||
|
||||
/**
|
||||
* 新增或修改司机
|
||||
*
|
||||
* @param driver 司机
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(Driver driver);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*
|
||||
* @param id 主键
|
||||
* @param status 状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean changeStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*
|
||||
* @param driver 查询参数
|
||||
* @return 统计信息
|
||||
*/
|
||||
DriverExpiryStatVO expiryStat(DriverVO driver);
|
||||
|
||||
/**
|
||||
* 导出司机
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<DriverExcel> exportDriver(Wrapper<Driver> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.EtcRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.EtcRecord;
|
||||
import org.springblade.transport.pojo.vo.EtcRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ETC记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IEtcRecordService extends BaseService<EtcRecord> {
|
||||
|
||||
IPage<EtcRecordVO> selectEtcRecordPage(IPage<EtcRecordVO> page, EtcRecordVO etcRecord);
|
||||
|
||||
boolean submit(EtcRecord etcRecord);
|
||||
|
||||
void importEtcRecord(List<EtcRecordExcel> data);
|
||||
|
||||
List<EtcRecordExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.InsuranceRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.InsuranceRecord;
|
||||
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保险记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IInsuranceRecordService extends BaseService<InsuranceRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param insuranceRecord 查询参数
|
||||
* @return 保险记录分页
|
||||
*/
|
||||
IPage<InsuranceRecordVO> selectInsuranceRecordPage(IPage<InsuranceRecordVO> page, InsuranceRecordVO insuranceRecord);
|
||||
|
||||
/**
|
||||
* 新增或修改保险记录
|
||||
*
|
||||
* @param insuranceRecord 保险记录
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(InsuranceRecord insuranceRecord);
|
||||
|
||||
/**
|
||||
* 导入保险记录
|
||||
*
|
||||
* @param data 导入数据
|
||||
*/
|
||||
void importInsuranceRecord(List<InsuranceRecordExcel> data);
|
||||
|
||||
/**
|
||||
* 导出保险记录
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<InsuranceRecordExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper);
|
||||
|
||||
/**
|
||||
* 识别保单文件
|
||||
*
|
||||
* @param file 保单图片或PDF
|
||||
* @param vehicleType 车船类型
|
||||
* @param ocrTemplate OCR模板
|
||||
* @return 识别结果
|
||||
*/
|
||||
InsuranceRecord recognizePolicy(MultipartFile file, String vehicleType, String ocrTemplate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.MileageRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.MileageRecord;
|
||||
import org.springblade.transport.pojo.vo.MileageRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 里程记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IMileageRecordService extends BaseService<MileageRecord> {
|
||||
|
||||
IPage<MileageRecordVO> selectMileageRecordPage(IPage<MileageRecordVO> page, MileageRecordVO mileageRecord);
|
||||
|
||||
boolean submit(MileageRecord mileageRecord);
|
||||
|
||||
void importMileageRecord(List<MileageRecordExcel> data);
|
||||
|
||||
List<MileageRecordExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.OilElectricRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.OilElectricRecord;
|
||||
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 油电记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IOilElectricRecordService extends BaseService<OilElectricRecord> {
|
||||
|
||||
IPage<OilElectricRecordVO> selectOilElectricRecordPage(IPage<OilElectricRecordVO> page, OilElectricRecordVO oilElectricRecord);
|
||||
|
||||
boolean submit(OilElectricRecord oilElectricRecord);
|
||||
|
||||
void importOilElectricRecord(List<OilElectricRecordExcel> data);
|
||||
|
||||
List<OilElectricRecordExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.OtherExpenseRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
|
||||
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 其他费用记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IOtherExpenseRecordService extends BaseService<OtherExpenseRecord> {
|
||||
|
||||
IPage<OtherExpenseRecordVO> selectOtherExpenseRecordPage(IPage<OtherExpenseRecordVO> page, OtherExpenseRecordVO otherExpenseRecord);
|
||||
|
||||
boolean submit(OtherExpenseRecord otherExpenseRecord);
|
||||
|
||||
void importOtherExpenseRecord(List<OtherExpenseRecordExcel> data);
|
||||
|
||||
List<OtherExpenseRecordExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.TireReplacementRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.TireReplacementRecord;
|
||||
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 换胎记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ITireReplacementRecordService extends BaseService<TireReplacementRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param tireReplacementRecord 查询参数
|
||||
* @return 换胎记录分页
|
||||
*/
|
||||
IPage<TireReplacementRecordVO> selectTireReplacementRecordPage(IPage<TireReplacementRecordVO> page, TireReplacementRecordVO tireReplacementRecord);
|
||||
|
||||
/**
|
||||
* 新增或修改换胎记录
|
||||
*
|
||||
* @param tireReplacementRecord 换胎记录
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(TireReplacementRecord tireReplacementRecord);
|
||||
|
||||
/**
|
||||
* 导入换胎记录
|
||||
*
|
||||
* @param data 导入数据
|
||||
*/
|
||||
void importTireReplacementRecord(List<TireReplacementRecordExcel> data);
|
||||
|
||||
/**
|
||||
* 导出换胎记录
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<TireReplacementRecordExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.TransportChangeRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.TransportChangeRecord;
|
||||
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 变更记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ITransportChangeRecordService extends BaseService<TransportChangeRecord> {
|
||||
|
||||
IPage<TransportChangeRecordVO> selectTransportChangeRecordPage(IPage<TransportChangeRecordVO> page, TransportChangeRecordVO transportChangeRecord);
|
||||
|
||||
boolean submit(TransportChangeRecord transportChangeRecord);
|
||||
|
||||
void importTransportChangeRecord(List<TransportChangeRecordExcel> data);
|
||||
|
||||
List<TransportChangeRecordExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.TransportShipExcel;
|
||||
import org.springblade.transport.pojo.entity.TransportShip;
|
||||
import org.springblade.transport.pojo.vo.TransportShipExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportShipVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 船舶管理 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ITransportShipService extends BaseService<TransportShip> {
|
||||
|
||||
IPage<TransportShipVO> selectTransportShipPage(IPage<TransportShipVO> page, TransportShipVO ship);
|
||||
|
||||
boolean submit(TransportShip ship);
|
||||
|
||||
boolean changeStatus(Long id, Integer status);
|
||||
|
||||
TransportShipExpiryStatVO expiryStat(TransportShipVO ship);
|
||||
|
||||
List<TransportShipExcel> exportTransportShip(Wrapper<TransportShip> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.TransportVehicleExcel;
|
||||
import org.springblade.transport.pojo.entity.TransportVehicle;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportVehicleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆管理 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ITransportVehicleService extends BaseService<TransportVehicle> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param vehicle 查询参数
|
||||
* @return 车辆分页
|
||||
*/
|
||||
IPage<TransportVehicleVO> selectTransportVehiclePage(IPage<TransportVehicleVO> page, TransportVehicleVO vehicle);
|
||||
|
||||
/**
|
||||
* 新增或修改车辆
|
||||
*
|
||||
* @param vehicle 车辆
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(TransportVehicle vehicle);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*
|
||||
* @param id 主键
|
||||
* @param status 状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean changeStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 证件有效期统计
|
||||
*
|
||||
* @param vehicle 查询参数
|
||||
* @return 统计信息
|
||||
*/
|
||||
TransportVehicleExpiryStatVO expiryStat(TransportVehicleVO vehicle);
|
||||
|
||||
/**
|
||||
* 导出车辆
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<TransportVehicleExcel> exportTransportVehicle(Wrapper<TransportVehicle> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.transport.excel.ViolationRecordExcel;
|
||||
import org.springblade.transport.pojo.entity.ViolationRecord;
|
||||
import org.springblade.transport.pojo.vo.ViolationRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违章记录 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IViolationRecordService extends BaseService<ViolationRecord> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param violationRecord 查询参数
|
||||
* @return 违章记录分页
|
||||
*/
|
||||
IPage<ViolationRecordVO> selectViolationRecordPage(IPage<ViolationRecordVO> page, ViolationRecordVO violationRecord);
|
||||
|
||||
/**
|
||||
* 新增或修改违章记录
|
||||
*
|
||||
* @param violationRecord 违章记录
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(ViolationRecord violationRecord);
|
||||
|
||||
/**
|
||||
* 导入违章记录
|
||||
*
|
||||
* @param data 导入数据
|
||||
*/
|
||||
void importViolationRecord(List<ViolationRecordExcel> data);
|
||||
|
||||
/**
|
||||
* 导出违章记录
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 导出数据
|
||||
*/
|
||||
List<ViolationRecordExcel> exportViolationRecord(Wrapper<ViolationRecord> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.AccidentRecordExcel;
|
||||
import org.springblade.transport.mapper.AccidentRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.AccidentRecord;
|
||||
import org.springblade.transport.pojo.vo.AccidentRecordVO;
|
||||
import org.springblade.transport.service.IAccidentRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 事故记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMapper, AccidentRecord> implements IAccidentRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int LOCATION_MAX_LENGTH = 100;
|
||||
private static final int REASON_DAMAGE_MAX_LENGTH = 500;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
private static final String VEHICLE = "车辆";
|
||||
private static final String SHIP = "船舶";
|
||||
|
||||
@Override
|
||||
public IPage<AccidentRecordVO> selectAccidentRecordPage(IPage<AccidentRecordVO> page, AccidentRecordVO accidentRecord) {
|
||||
return page.setRecords(baseMapper.selectAccidentRecordPage(page, accidentRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(AccidentRecord accidentRecord) {
|
||||
prepare(accidentRecord);
|
||||
validate(accidentRecord);
|
||||
validateVehicleTypeImmutable(accidentRecord);
|
||||
return saveOrUpdate(accidentRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importAccidentRecord(List<AccidentRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
AccidentRecord accidentRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), AccidentRecord.class));
|
||||
submit(accidentRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccidentRecordExcel> exportAccidentRecord(Wrapper<AccidentRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(accidentRecord -> {
|
||||
AccidentRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(accidentRecord, AccidentRecordExcel.class));
|
||||
excel.setDirectEconomicLoss(nonNegative(accidentRecord.getDirectEconomicLoss()));
|
||||
excel.setInsuranceClaimAmount(nonNegative(accidentRecord.getInsuranceClaimAmount()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(AccidentRecord accidentRecord) {
|
||||
accidentRecord.setVehicleType(normalizeVehicleType(accidentRecord.getVehicleType()));
|
||||
accidentRecord.setVehicleNo(trimToEmpty(accidentRecord.getVehicleNo()).toUpperCase());
|
||||
accidentRecord.setAccidentLocation(trimToNull(accidentRecord.getAccidentLocation()));
|
||||
accidentRecord.setAccidentNature(trimToNull(accidentRecord.getAccidentNature()));
|
||||
accidentRecord.setAccidentResponsibility(trimToNull(accidentRecord.getAccidentResponsibility()));
|
||||
accidentRecord.setAccidentReasonDamage(trimToNull(accidentRecord.getAccidentReasonDamage()));
|
||||
accidentRecord.setAttachments(trimToNull(accidentRecord.getAttachments()));
|
||||
accidentRecord.setRemark(trimToNull(accidentRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(AccidentRecord accidentRecord) {
|
||||
if (Func.isEmpty(accidentRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!VEHICLE.equals(accidentRecord.getVehicleType()) && !SHIP.equals(accidentRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(accidentRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号/船号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(accidentRecord.getAccidentDate())) {
|
||||
throw new ServiceException("事故发生日期不能为空");
|
||||
}
|
||||
validateLength(accidentRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(accidentRecord.getAccidentLocation(), LOCATION_MAX_LENGTH, "事故发生地点不能超过100字");
|
||||
validateLength(accidentRecord.getAccidentReasonDamage(), REASON_DAMAGE_MAX_LENGTH, "事故原因及损坏情况不能超过500字");
|
||||
validateLength(accidentRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(accidentRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMoney(accidentRecord.getDirectEconomicLoss(), "直接经济损失");
|
||||
validateMoney(accidentRecord.getInsuranceClaimAmount(), "保险理赔金额");
|
||||
if (Func.isNotEmpty(accidentRecord.getInsuranceClaimAmount())
|
||||
&& Func.isNotEmpty(accidentRecord.getDirectEconomicLoss())
|
||||
&& accidentRecord.getInsuranceClaimAmount().compareTo(accidentRecord.getDirectEconomicLoss()) > 0) {
|
||||
throw new ServiceException("保险理赔金额不能超过直接经济损失金额");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateVehicleTypeImmutable(AccidentRecord accidentRecord) {
|
||||
if (Func.isEmpty(accidentRecord.getId())) {
|
||||
return;
|
||||
}
|
||||
AccidentRecord oldRecord = getById(accidentRecord.getId());
|
||||
if (oldRecord != null && Func.isNotEmpty(oldRecord.getVehicleType()) && !oldRecord.getVehicleType().equals(accidentRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型保存后不可修改");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMoney(BigDecimal value, String fieldName) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > MONEY_SCALE) {
|
||||
throw new ServiceException(fieldName + "最多保留2位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? VEHICLE : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.AnnualInspectionRecordExcel;
|
||||
import org.springblade.transport.mapper.AnnualInspectionRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.AnnualInspectionRecord;
|
||||
import org.springblade.transport.pojo.vo.AnnualInspectionRecordVO;
|
||||
import org.springblade.transport.service.IAnnualInspectionRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 年检记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualInspectionRecordMapper, AnnualInspectionRecord> implements IAnnualInspectionRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int PASSENGER_TYPE_LEVEL_MAX_LENGTH = 50;
|
||||
private static final int INSPECTION_UNIT_MAX_LENGTH = 50;
|
||||
private static final int ASSESSMENT_UNIT_MAX_LENGTH = 50;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
private static final String VEHICLE = "车辆";
|
||||
private static final String SHIP = "船舶";
|
||||
|
||||
@Override
|
||||
public IPage<AnnualInspectionRecordVO> selectAnnualInspectionRecordPage(IPage<AnnualInspectionRecordVO> page, AnnualInspectionRecordVO annualInspectionRecord) {
|
||||
return page.setRecords(baseMapper.selectAnnualInspectionRecordPage(page, annualInspectionRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(AnnualInspectionRecord annualInspectionRecord) {
|
||||
prepare(annualInspectionRecord);
|
||||
validate(annualInspectionRecord);
|
||||
validateVehicleTypeImmutable(annualInspectionRecord);
|
||||
return saveOrUpdate(annualInspectionRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importAnnualInspectionRecord(List<AnnualInspectionRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
AnnualInspectionRecordExcel excel = data.get(index);
|
||||
AnnualInspectionRecord annualInspectionRecord = Objects.requireNonNull(BeanUtil.copyProperties(excel, AnnualInspectionRecord.class));
|
||||
fillInspectionContent(annualInspectionRecord, excel.getInspectionContent());
|
||||
submit(annualInspectionRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnnualInspectionRecordExcel> exportAnnualInspectionRecord(Wrapper<AnnualInspectionRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(annualInspectionRecord -> {
|
||||
AnnualInspectionRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(annualInspectionRecord, AnnualInspectionRecordExcel.class));
|
||||
excel.setInspectionContent(inspectionContent(annualInspectionRecord));
|
||||
excel.setFee(nonNegative(annualInspectionRecord.getFee()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(AnnualInspectionRecord annualInspectionRecord) {
|
||||
annualInspectionRecord.setVehicleType(normalizeVehicleType(annualInspectionRecord.getVehicleType()));
|
||||
annualInspectionRecord.setVehicleNo(trimToEmpty(annualInspectionRecord.getVehicleNo()).toUpperCase());
|
||||
annualInspectionRecord.setVehicleTechnicalLevel(trimToNull(annualInspectionRecord.getVehicleTechnicalLevel()));
|
||||
annualInspectionRecord.setShipInspectionType(trimToNull(annualInspectionRecord.getShipInspectionType()));
|
||||
annualInspectionRecord.setPassengerTypeLevel(trimToNull(annualInspectionRecord.getPassengerTypeLevel()));
|
||||
annualInspectionRecord.setInspectionUnit(trimToNull(annualInspectionRecord.getInspectionUnit()));
|
||||
annualInspectionRecord.setAssessmentUnit(trimToNull(annualInspectionRecord.getAssessmentUnit()));
|
||||
annualInspectionRecord.setAttachments(trimToNull(annualInspectionRecord.getAttachments()));
|
||||
annualInspectionRecord.setRemark(trimToNull(annualInspectionRecord.getRemark()));
|
||||
if (annualInspectionRecord.getInspectionAssessmentDate() == null) {
|
||||
annualInspectionRecord.setInspectionAssessmentDate(LocalDate.now());
|
||||
}
|
||||
if (VEHICLE.equals(annualInspectionRecord.getVehicleType())) {
|
||||
annualInspectionRecord.setShipInspectionType(null);
|
||||
} else {
|
||||
annualInspectionRecord.setVehicleTechnicalLevel(null);
|
||||
annualInspectionRecord.setPassengerTypeLevel(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(AnnualInspectionRecord annualInspectionRecord) {
|
||||
if (Func.isEmpty(annualInspectionRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!VEHICLE.equals(annualInspectionRecord.getVehicleType()) && !SHIP.equals(annualInspectionRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(annualInspectionRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号/船号不能为空");
|
||||
}
|
||||
if (VEHICLE.equals(annualInspectionRecord.getVehicleType()) && Func.isEmpty(annualInspectionRecord.getVehicleTechnicalLevel())) {
|
||||
throw new ServiceException("车辆技术等级不能为空");
|
||||
}
|
||||
if (SHIP.equals(annualInspectionRecord.getVehicleType()) && Func.isEmpty(annualInspectionRecord.getShipInspectionType())) {
|
||||
throw new ServiceException("船舶检验类型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(annualInspectionRecord.getValidUntilDate())) {
|
||||
throw new ServiceException("有效期截止日不能为空");
|
||||
}
|
||||
if (!annualInspectionRecord.getValidUntilDate().isAfter(annualInspectionRecord.getInspectionAssessmentDate())) {
|
||||
throw new ServiceException("有效期截止日应大于检测评定日期");
|
||||
}
|
||||
if (Func.isEmpty(annualInspectionRecord.getFee())) {
|
||||
throw new ServiceException("费用不能为空");
|
||||
}
|
||||
validateLength(annualInspectionRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(annualInspectionRecord.getPassengerTypeLevel(), PASSENGER_TYPE_LEVEL_MAX_LENGTH, "客车类型及等级不能超过50字");
|
||||
validateLength(annualInspectionRecord.getInspectionUnit(), INSPECTION_UNIT_MAX_LENGTH, "检测评定单位不能超过50字");
|
||||
validateLength(annualInspectionRecord.getAssessmentUnit(), ASSESSMENT_UNIT_MAX_LENGTH, "评定(复核)单位不能超过50字");
|
||||
validateLength(annualInspectionRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(annualInspectionRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMoney(annualInspectionRecord.getFee(), "费用");
|
||||
}
|
||||
|
||||
private void validateVehicleTypeImmutable(AnnualInspectionRecord annualInspectionRecord) {
|
||||
if (Func.isEmpty(annualInspectionRecord.getId())) {
|
||||
return;
|
||||
}
|
||||
AnnualInspectionRecord oldRecord = getById(annualInspectionRecord.getId());
|
||||
if (oldRecord != null && Func.isNotEmpty(oldRecord.getVehicleType()) && !oldRecord.getVehicleType().equals(annualInspectionRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型保存后不可修改");
|
||||
}
|
||||
}
|
||||
|
||||
private void fillInspectionContent(AnnualInspectionRecord annualInspectionRecord, String inspectionContent) {
|
||||
if (SHIP.equals(normalizeVehicleType(annualInspectionRecord.getVehicleType()))) {
|
||||
annualInspectionRecord.setShipInspectionType(inspectionContent);
|
||||
} else {
|
||||
annualInspectionRecord.setVehicleTechnicalLevel(inspectionContent);
|
||||
}
|
||||
}
|
||||
|
||||
private String inspectionContent(AnnualInspectionRecord annualInspectionRecord) {
|
||||
return SHIP.equals(annualInspectionRecord.getVehicleType()) ? annualInspectionRecord.getShipInspectionType() : annualInspectionRecord.getVehicleTechnicalLevel();
|
||||
}
|
||||
|
||||
private void validateMoney(BigDecimal value, String fieldName) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > MONEY_SCALE) {
|
||||
throw new ServiceException(fieldName + "最多保留2位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? VEHICLE : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -516,7 +516,7 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
|
||||
List<CreditRatingStandardVO> sortedStandards = standards.stream()
|
||||
.sorted(Comparator.comparing(CreditRatingStandardVO::getScoreRateLower))
|
||||
.toList();
|
||||
int expectedLower = 0;
|
||||
Integer previousUpper = null;
|
||||
for (CreditRatingStandardVO standard : sortedStandards) {
|
||||
prepareStandard(standard);
|
||||
if (!creditLevels.add(standard.getCreditLevel())) {
|
||||
@@ -528,10 +528,10 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
|
||||
if (standard.getScoreRateLower() >= standard.getScoreRateUpper()) {
|
||||
throw new ServiceException("得分率下限必须小于上限");
|
||||
}
|
||||
if (standard.getScoreRateLower() != expectedLower) {
|
||||
throw new ServiceException("信用等级得分率区间必须连续无断层");
|
||||
if (previousUpper != null && standard.getScoreRateLower() < previousUpper) {
|
||||
throw new ServiceException("信用等级得分率区间不能重叠");
|
||||
}
|
||||
expectedLower = standard.getScoreRateUpper();
|
||||
previousUpper = standard.getScoreRateUpper();
|
||||
validateNonNegative(standard.getCreditLimitLower(), "最大资金使用额度下限不能小于0");
|
||||
validateNonNegative(standard.getCreditLimitUpper(), "最大资金使用额度上限不能小于0");
|
||||
validateNonNegative(standard.getCreditLimitIncrease(), "额度增加不能小于0");
|
||||
@@ -540,9 +540,6 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
|
||||
}
|
||||
validateLength(standard.getStandardDescription(), STANDARD_DESCRIPTION_MAX_LENGTH, "标准说明最多500字符");
|
||||
}
|
||||
if (expectedLower != 100) {
|
||||
throw new ServiceException("信用等级得分率区间必须覆盖0到100");
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareStandard(CreditRatingStandardVO standard) {
|
||||
|
||||
@@ -0,0 +1,633 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.CustomerArchiveExcel;
|
||||
import org.springblade.transport.mapper.CreditRatingStandardMapper;
|
||||
import org.springblade.transport.mapper.CreditScoreCategoryMapper;
|
||||
import org.springblade.transport.mapper.CreditScoreItemMapper;
|
||||
import org.springblade.transport.mapper.CreditScoreItemOptionMapper;
|
||||
import org.springblade.transport.mapper.CreditScoreQuantificationMapper;
|
||||
import org.springblade.transport.mapper.CustomerArchiveMapper;
|
||||
import org.springblade.transport.mapper.CustomerChangeRecordMapper;
|
||||
import org.springblade.transport.mapper.CustomerContactMapper;
|
||||
import org.springblade.transport.mapper.CustomerCreditScoreDetailMapper;
|
||||
import org.springblade.transport.mapper.CustomerCreditScoreMapper;
|
||||
import org.springblade.transport.mapper.CustomerInvoiceInfoMapper;
|
||||
import org.springblade.transport.mapper.CustomerReceiptAccountMapper;
|
||||
import org.springblade.transport.pojo.entity.CreditRatingStandard;
|
||||
import org.springblade.transport.pojo.entity.CreditScoreCategory;
|
||||
import org.springblade.transport.pojo.entity.CreditScoreItem;
|
||||
import org.springblade.transport.pojo.entity.CreditScoreItemOption;
|
||||
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.entity.CustomerChangeRecord;
|
||||
import org.springblade.transport.pojo.entity.CustomerContact;
|
||||
import org.springblade.transport.pojo.entity.CustomerCreditScore;
|
||||
import org.springblade.transport.pojo.entity.CustomerCreditScoreDetail;
|
||||
import org.springblade.transport.pojo.entity.CustomerInvoiceInfo;
|
||||
import org.springblade.transport.pojo.entity.CustomerReceiptAccount;
|
||||
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerChangeRecordVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerContactVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerCreditScoreDetailVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerCreditScoreVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerInvoiceInfoVO;
|
||||
import org.springblade.transport.pojo.vo.CustomerReceiptAccountVO;
|
||||
import org.springblade.transport.service.ICustomerArchiveService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 客商档案 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveMapper, CustomerArchive> implements ICustomerArchiveService {
|
||||
|
||||
private static final int STATUS_ENABLED = 1;
|
||||
private static final int STATUS_DISABLED = 2;
|
||||
private static final String ACCESS_TEMPORARY = "temporary";
|
||||
private static final String ACCESS_FORMAL = "formal";
|
||||
private static final String APPROVAL_DRAFT = "draft";
|
||||
private static final String APPROVAL_REVIEWING = "reviewing";
|
||||
private static final String APPROVAL_APPROVED = "approved";
|
||||
private static final String APPROVAL_REJECTED = "rejected";
|
||||
private static final String CUSTOMER_CODE_PREFIX = "KS";
|
||||
|
||||
private final CustomerContactMapper contactMapper;
|
||||
private final CustomerReceiptAccountMapper receiptAccountMapper;
|
||||
private final CustomerInvoiceInfoMapper invoiceInfoMapper;
|
||||
private final CustomerCreditScoreMapper creditScoreMapper;
|
||||
private final CustomerCreditScoreDetailMapper creditScoreDetailMapper;
|
||||
private final CustomerChangeRecordMapper changeRecordMapper;
|
||||
private final CreditScoreQuantificationMapper quantificationMapper;
|
||||
private final CreditScoreCategoryMapper categoryMapper;
|
||||
private final CreditScoreItemMapper itemMapper;
|
||||
private final CreditScoreItemOptionMapper optionMapper;
|
||||
private final CreditRatingStandardMapper standardMapper;
|
||||
|
||||
@Override
|
||||
public IPage<CustomerArchiveVO> selectCustomerArchivePage(IPage<CustomerArchiveVO> page, CustomerArchiveVO customer) {
|
||||
return page.setRecords(baseMapper.selectCustomerArchivePage(page, customer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerArchiveVO detail(Long id) {
|
||||
if (Func.isEmpty(id)) {
|
||||
throw new ServiceException("主键不能为空");
|
||||
}
|
||||
CustomerArchive customer = getById(id);
|
||||
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
|
||||
throw new ServiceException("客商档案不存在");
|
||||
}
|
||||
CustomerArchiveVO detail = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchiveVO.class));
|
||||
detail.setContacts(loadContacts(id));
|
||||
detail.setReceiptAccounts(loadReceiptAccounts(id));
|
||||
detail.setInvoices(loadInvoices(id));
|
||||
detail.setScores(loadScores(id));
|
||||
detail.setChangeRecords(loadChangeRecords(id));
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(CustomerArchiveVO customer) {
|
||||
prepare(customer);
|
||||
validateBase(customer);
|
||||
boolean created = Func.isEmpty(customer.getId());
|
||||
if (created) {
|
||||
customer.setCustomerCode(nextCustomerCode());
|
||||
}
|
||||
CustomerArchive entity = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchive.class));
|
||||
boolean result = saveOrUpdate(entity);
|
||||
replaceDetail(entity.getId(), customer);
|
||||
addChangeRecord(entity.getId(), created ? "新增客商档案" : "修改客商档案");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submitApproval(Long id) {
|
||||
CustomerArchiveVO detail = detail(id);
|
||||
prepare(detail);
|
||||
validateBase(detail);
|
||||
validateApproval(detail);
|
||||
CustomerArchive update = new CustomerArchive();
|
||||
update.setId(id);
|
||||
update.setApprovalStatus(APPROVAL_REVIEWING);
|
||||
update.setCurrentNode("客商准入审批");
|
||||
update.setCurrentProcessor("待处理");
|
||||
addChangeRecord(id, "提交客商准入审批");
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean approve(Long id) {
|
||||
CustomerArchiveVO detail = detail(id);
|
||||
prepare(detail);
|
||||
validateBase(detail);
|
||||
validateApproval(detail);
|
||||
CustomerArchive update = new CustomerArchive();
|
||||
update.setId(id);
|
||||
update.setApprovalStatus(APPROVAL_APPROVED);
|
||||
update.setCurrentNode("审核通过");
|
||||
update.setCurrentProcessor(AuthUtil.getUserName());
|
||||
update.setApprovedTime(LocalDateTime.now());
|
||||
addChangeRecord(id, "客商准入审核通过");
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean reject(Long id) {
|
||||
CustomerArchive update = new CustomerArchive();
|
||||
update.setId(id);
|
||||
update.setApprovalStatus(APPROVAL_REJECTED);
|
||||
update.setCurrentNode("审核不通过");
|
||||
update.setCurrentProcessor(AuthUtil.getUserName());
|
||||
addChangeRecord(id, "客商准入审核不通过");
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean changeStatus(Long id, Integer status) {
|
||||
if (!Objects.equals(status, STATUS_ENABLED) && !Objects.equals(status, STATUS_DISABLED)) {
|
||||
throw new ServiceException("启停状态不正确");
|
||||
}
|
||||
CustomerArchive customer = getById(id);
|
||||
if (Func.isEmpty(customer) || Objects.equals(customer.getIsDeleted(), 1)) {
|
||||
throw new ServiceException("客商档案不存在");
|
||||
}
|
||||
CustomerArchive update = new CustomerArchive();
|
||||
update.setId(id);
|
||||
update.setStatus(status);
|
||||
addChangeRecord(id, Objects.equals(status, STATUS_ENABLED) ? "启用客商档案" : "停用客商档案");
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean removeDraft(String ids) {
|
||||
List<Long> idList = Func.toLongList(ids);
|
||||
if (Func.isEmpty(idList)) {
|
||||
throw new ServiceException("请选择需要删除的数据");
|
||||
}
|
||||
List<CustomerArchive> customers = listByIds(idList);
|
||||
for (CustomerArchive customer : customers) {
|
||||
if (!Objects.equals(customer.getApprovalStatus(), APPROVAL_DRAFT)) {
|
||||
throw new ServiceException("仅草稿状态客商可删除");
|
||||
}
|
||||
}
|
||||
deleteDetail(idList);
|
||||
return deleteLogic(idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerCreditScoreVO buildScoreTemplate(Long quantificationId) {
|
||||
CreditScoreQuantification quantification = resolveQuantification(quantificationId);
|
||||
CustomerCreditScoreVO score = new CustomerCreditScoreVO();
|
||||
score.setQuantificationId(quantification.getId());
|
||||
score.setScoreDate(LocalDate.now());
|
||||
score.setSelfStatus("未完成");
|
||||
score.setReviewStatus("未完成");
|
||||
score.setDetails(loadScoreTemplateDetails(quantification.getId()));
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerArchiveExcel> exportCustomerArchive(Wrapper<CustomerArchive> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(this::buildExcel).toList();
|
||||
}
|
||||
|
||||
private void prepare(CustomerArchiveVO customer) {
|
||||
customer.setShortName(trimToNull(customer.getShortName()));
|
||||
customer.setFullName(trimToEmpty(customer.getFullName()));
|
||||
customer.setCustomerNature(trimToEmpty(customer.getCustomerNature()));
|
||||
customer.setUnifiedCreditCode(trimToEmpty(customer.getUnifiedCreditCode()));
|
||||
customer.setCustomerType(trimToEmpty(customer.getCustomerType()));
|
||||
customer.setLegalPerson(trimToEmpty(customer.getLegalPerson()));
|
||||
customer.setContactPhone(trimToEmpty(customer.getContactPhone()));
|
||||
customer.setDeptName(trimToEmpty(customer.getDeptName()));
|
||||
customer.setAccessType(Func.isEmpty(customer.getAccessType()) ? ACCESS_TEMPORARY : customer.getAccessType());
|
||||
customer.setApprovalStatus(Func.isEmpty(customer.getApprovalStatus()) ? APPROVAL_DRAFT : customer.getApprovalStatus());
|
||||
if (Func.isEmpty(customer.getStatus())) {
|
||||
customer.setStatus(STATUS_ENABLED);
|
||||
}
|
||||
customer.setContacts(customer.getContacts() == null ? new ArrayList<>() : customer.getContacts());
|
||||
customer.setReceiptAccounts(customer.getReceiptAccounts() == null ? new ArrayList<>() : customer.getReceiptAccounts());
|
||||
customer.setInvoices(customer.getInvoices() == null ? new ArrayList<>() : customer.getInvoices());
|
||||
customer.setScores(customer.getScores() == null ? new ArrayList<>() : customer.getScores());
|
||||
}
|
||||
|
||||
private void validateBase(CustomerArchiveVO customer) {
|
||||
if (Func.isEmpty(customer.getFullName())) {
|
||||
throw new ServiceException("客商全称不能为空");
|
||||
}
|
||||
if (Func.isEmpty(customer.getCustomerNature())) {
|
||||
throw new ServiceException("客商性质不能为空");
|
||||
}
|
||||
if (Func.isEmpty(customer.getUnifiedCreditCode())) {
|
||||
throw new ServiceException("统一社会信用代码不能为空");
|
||||
}
|
||||
if (!customer.getUnifiedCreditCode().matches("^[A-Z0-9]{18}$")) {
|
||||
throw new ServiceException("统一社会信用代码必须为18位大写字母或数字");
|
||||
}
|
||||
if (Func.isEmpty(customer.getCustomerType())) {
|
||||
throw new ServiceException("客商类型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(customer.getLegalPerson())) {
|
||||
throw new ServiceException("法人/负责人不能为空");
|
||||
}
|
||||
if (Func.isEmpty(customer.getContactPhone())) {
|
||||
throw new ServiceException("联系电话不能为空");
|
||||
}
|
||||
if (!customer.getContactPhone().matches("^1\\d{10}$")) {
|
||||
throw new ServiceException("联系电话必须为11位手机号");
|
||||
}
|
||||
if (Func.isEmpty(customer.getDeptName())) {
|
||||
throw new ServiceException("所属组织不能为空");
|
||||
}
|
||||
validateLength(customer.getShortName(), 20, "客商简称最多20个汉字");
|
||||
validateLength(customer.getFullName(), 100, "客商全称最多100个字符");
|
||||
validateLength(customer.getRegisteredAddress(), 200, "地址最多200个字符");
|
||||
validateLength(customer.getBusinessScope(), 500, "经营范围最多500个字符");
|
||||
validateLength(customer.getRemark(), 500, "备注最多500个字符");
|
||||
validateNonNegative(customer.getInvoiceTaxRate(), "开票税点不能小于0");
|
||||
validateNonNegative(customer.getRegisteredCapital(), "注册资金不能小于0");
|
||||
validateNonNegative(customer.getMaxCreditLimit(), "最大资金使用额度不能小于0");
|
||||
validateNonNegative(customer.getApplyCreditLimit(), "申请总资金使用额度不能小于0");
|
||||
validateUnique(customer);
|
||||
}
|
||||
|
||||
private void validateApproval(CustomerArchiveVO customer) {
|
||||
if (Objects.equals(customer.getAccessType(), ACCESS_FORMAL)) {
|
||||
if (Func.isEmpty(customer.getQualificationAttachments())) {
|
||||
throw new ServiceException("正式客商提交审核前必须上传资质附件");
|
||||
}
|
||||
boolean hasCompletedScore = customer.getScores().stream()
|
||||
.anyMatch(score -> "已完成".equals(score.getSelfStatus()) || "已完成".equals(score.getReviewStatus()) || Func.isNotEmpty(score.getFinalScore()));
|
||||
if (!hasCompletedScore) {
|
||||
throw new ServiceException("正式客商提交审核前必须完成信用评分");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateUnique(CustomerArchiveVO customer) {
|
||||
if (count(Wrappers.<CustomerArchive>lambdaQuery()
|
||||
.eq(CustomerArchive::getUnifiedCreditCode, customer.getUnifiedCreditCode())
|
||||
.eq(CustomerArchive::getIsDeleted, 0)
|
||||
.ne(Func.isNotEmpty(customer.getId()), CustomerArchive::getId, customer.getId())) > 0L) {
|
||||
throw new ServiceException("统一社会信用代码已存在");
|
||||
}
|
||||
if (Func.isNotEmpty(customer.getCustomerCode()) && count(Wrappers.<CustomerArchive>lambdaQuery()
|
||||
.eq(CustomerArchive::getCustomerCode, customer.getCustomerCode())
|
||||
.eq(CustomerArchive::getIsDeleted, 0)
|
||||
.ne(Func.isNotEmpty(customer.getId()), CustomerArchive::getId, customer.getId())) > 0L) {
|
||||
throw new ServiceException("客商编号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceDetail(Long customerId, CustomerArchiveVO customer) {
|
||||
deleteDetail(List.of(customerId));
|
||||
insertContacts(customerId, customer.getContacts());
|
||||
insertReceiptAccounts(customerId, customer.getReceiptAccounts());
|
||||
insertInvoices(customerId, customer.getInvoices());
|
||||
insertScores(customerId, customer.getScores());
|
||||
}
|
||||
|
||||
private void insertContacts(Long customerId, List<CustomerContactVO> contacts) {
|
||||
for (CustomerContactVO contactVO : contacts) {
|
||||
if (Func.isEmpty(contactVO.getContactName()) && Func.isEmpty(contactVO.getContactPhone())) {
|
||||
continue;
|
||||
}
|
||||
CustomerContact contact = Objects.requireNonNull(BeanUtil.copyProperties(contactVO, CustomerContact.class));
|
||||
contact.setId(IdWorker.getId());
|
||||
contact.setCustomerId(customerId);
|
||||
contact.setStatus(STATUS_ENABLED);
|
||||
contactMapper.insert(contact);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertReceiptAccounts(Long customerId, List<CustomerReceiptAccountVO> accounts) {
|
||||
for (CustomerReceiptAccountVO accountVO : accounts) {
|
||||
if (Func.isEmpty(accountVO.getAccountName()) && Func.isEmpty(accountVO.getBankAccount())) {
|
||||
continue;
|
||||
}
|
||||
CustomerReceiptAccount account = Objects.requireNonNull(BeanUtil.copyProperties(accountVO, CustomerReceiptAccount.class));
|
||||
account.setId(IdWorker.getId());
|
||||
account.setCustomerId(customerId);
|
||||
account.setStatus(STATUS_ENABLED);
|
||||
receiptAccountMapper.insert(account);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertInvoices(Long customerId, List<CustomerInvoiceInfoVO> invoices) {
|
||||
for (CustomerInvoiceInfoVO invoiceVO : invoices) {
|
||||
if (Func.isEmpty(invoiceVO.getInvoiceTitle()) && Func.isEmpty(invoiceVO.getTaxNo())) {
|
||||
continue;
|
||||
}
|
||||
CustomerInvoiceInfo invoice = Objects.requireNonNull(BeanUtil.copyProperties(invoiceVO, CustomerInvoiceInfo.class));
|
||||
invoice.setId(IdWorker.getId());
|
||||
invoice.setCustomerId(customerId);
|
||||
invoice.setStatus(STATUS_ENABLED);
|
||||
invoiceInfoMapper.insert(invoice);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertScores(Long customerId, List<CustomerCreditScoreVO> scores) {
|
||||
for (CustomerCreditScoreVO scoreVO : scores) {
|
||||
if (Func.isEmpty(scoreVO.getQuantificationId()) && Func.isEmpty(scoreVO.getScoreDate())) {
|
||||
continue;
|
||||
}
|
||||
Long scoreId = IdWorker.getId();
|
||||
CustomerCreditScore score = Objects.requireNonNull(BeanUtil.copyProperties(scoreVO, CustomerCreditScore.class));
|
||||
score.setId(scoreId);
|
||||
score.setCustomerId(customerId);
|
||||
score.setStatus(STATUS_ENABLED);
|
||||
creditScoreMapper.insert(score);
|
||||
List<CustomerCreditScoreDetailVO> details = scoreVO.getDetails() == null ? new ArrayList<>() : scoreVO.getDetails();
|
||||
for (int detailIndex = 0; detailIndex < details.size(); detailIndex++) {
|
||||
CustomerCreditScoreDetail detail = Objects.requireNonNull(BeanUtil.copyProperties(details.get(detailIndex), CustomerCreditScoreDetail.class));
|
||||
detail.setId(IdWorker.getId());
|
||||
detail.setScoreId(scoreId);
|
||||
detail.setQuantificationId(score.getQuantificationId());
|
||||
detail.setSort(detailIndex + 1);
|
||||
detail.setStatus(STATUS_ENABLED);
|
||||
creditScoreDetailMapper.insert(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDetail(List<Long> customerIds) {
|
||||
contactMapper.update(null, Wrappers.<CustomerContact>lambdaUpdate().in(CustomerContact::getCustomerId, customerIds).set(CustomerContact::getIsDeleted, 1));
|
||||
receiptAccountMapper.update(null, Wrappers.<CustomerReceiptAccount>lambdaUpdate().in(CustomerReceiptAccount::getCustomerId, customerIds).set(CustomerReceiptAccount::getIsDeleted, 1));
|
||||
invoiceInfoMapper.update(null, Wrappers.<CustomerInvoiceInfo>lambdaUpdate().in(CustomerInvoiceInfo::getCustomerId, customerIds).set(CustomerInvoiceInfo::getIsDeleted, 1));
|
||||
List<CustomerCreditScore> scores = creditScoreMapper.selectList(Wrappers.<CustomerCreditScore>lambdaQuery().in(CustomerCreditScore::getCustomerId, customerIds).eq(CustomerCreditScore::getIsDeleted, 0));
|
||||
if (Func.isNotEmpty(scores)) {
|
||||
List<Long> scoreIds = scores.stream().map(CustomerCreditScore::getId).toList();
|
||||
creditScoreDetailMapper.update(null, Wrappers.<CustomerCreditScoreDetail>lambdaUpdate().in(CustomerCreditScoreDetail::getScoreId, scoreIds).set(CustomerCreditScoreDetail::getIsDeleted, 1));
|
||||
creditScoreMapper.update(null, Wrappers.<CustomerCreditScore>lambdaUpdate().in(CustomerCreditScore::getId, scoreIds).set(CustomerCreditScore::getIsDeleted, 1));
|
||||
}
|
||||
}
|
||||
|
||||
private List<CustomerContactVO> loadContacts(Long customerId) {
|
||||
return contactMapper.selectList(Wrappers.<CustomerContact>lambdaQuery()
|
||||
.eq(CustomerContact::getCustomerId, customerId)
|
||||
.eq(CustomerContact::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerContact::getIsDefault)
|
||||
.orderByAsc(CustomerContact::getCreateTime))
|
||||
.stream().map(contact -> Objects.requireNonNull(BeanUtil.copyProperties(contact, CustomerContactVO.class))).toList();
|
||||
}
|
||||
|
||||
private List<CustomerReceiptAccountVO> loadReceiptAccounts(Long customerId) {
|
||||
return receiptAccountMapper.selectList(Wrappers.<CustomerReceiptAccount>lambdaQuery()
|
||||
.eq(CustomerReceiptAccount::getCustomerId, customerId)
|
||||
.eq(CustomerReceiptAccount::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerReceiptAccount::getIsDefault)
|
||||
.orderByAsc(CustomerReceiptAccount::getCreateTime))
|
||||
.stream().map(account -> Objects.requireNonNull(BeanUtil.copyProperties(account, CustomerReceiptAccountVO.class))).toList();
|
||||
}
|
||||
|
||||
private List<CustomerInvoiceInfoVO> loadInvoices(Long customerId) {
|
||||
return invoiceInfoMapper.selectList(Wrappers.<CustomerInvoiceInfo>lambdaQuery()
|
||||
.eq(CustomerInvoiceInfo::getCustomerId, customerId)
|
||||
.eq(CustomerInvoiceInfo::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerInvoiceInfo::getIsDefault)
|
||||
.orderByAsc(CustomerInvoiceInfo::getCreateTime))
|
||||
.stream().map(invoice -> Objects.requireNonNull(BeanUtil.copyProperties(invoice, CustomerInvoiceInfoVO.class))).toList();
|
||||
}
|
||||
|
||||
private List<CustomerCreditScoreVO> loadScores(Long customerId) {
|
||||
List<CustomerCreditScore> scores = creditScoreMapper.selectList(Wrappers.<CustomerCreditScore>lambdaQuery()
|
||||
.eq(CustomerCreditScore::getCustomerId, customerId)
|
||||
.eq(CustomerCreditScore::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerCreditScore::getScoreDate)
|
||||
.orderByDesc(CustomerCreditScore::getCreateTime));
|
||||
if (Func.isEmpty(scores)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> scoreIds = scores.stream().map(CustomerCreditScore::getId).toList();
|
||||
Map<Long, List<CustomerCreditScoreDetailVO>> detailMap = creditScoreDetailMapper.selectList(Wrappers.<CustomerCreditScoreDetail>lambdaQuery()
|
||||
.in(CustomerCreditScoreDetail::getScoreId, scoreIds)
|
||||
.eq(CustomerCreditScoreDetail::getIsDeleted, 0)
|
||||
.orderByAsc(CustomerCreditScoreDetail::getSort))
|
||||
.stream()
|
||||
.map(detail -> Objects.requireNonNull(BeanUtil.copyProperties(detail, CustomerCreditScoreDetailVO.class)))
|
||||
.collect(Collectors.groupingBy(CustomerCreditScoreDetailVO::getScoreId));
|
||||
return scores.stream().map(score -> {
|
||||
CustomerCreditScoreVO scoreVO = Objects.requireNonNull(BeanUtil.copyProperties(score, CustomerCreditScoreVO.class));
|
||||
scoreVO.setDetails(detailMap.getOrDefault(score.getId(), new ArrayList<>()));
|
||||
return scoreVO;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private List<CustomerChangeRecordVO> loadChangeRecords(Long customerId) {
|
||||
return changeRecordMapper.selectList(Wrappers.<CustomerChangeRecord>lambdaQuery()
|
||||
.eq(CustomerChangeRecord::getCustomerId, customerId)
|
||||
.eq(CustomerChangeRecord::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerChangeRecord::getChangeTime))
|
||||
.stream().map(record -> Objects.requireNonNull(BeanUtil.copyProperties(record, CustomerChangeRecordVO.class))).toList();
|
||||
}
|
||||
|
||||
private CreditScoreQuantification resolveQuantification(Long quantificationId) {
|
||||
CreditScoreQuantification quantification;
|
||||
if (Func.isNotEmpty(quantificationId)) {
|
||||
quantification = quantificationMapper.selectById(quantificationId);
|
||||
} else {
|
||||
quantification = quantificationMapper.selectList(Wrappers.<CreditScoreQuantification>lambdaQuery()
|
||||
.eq(CreditScoreQuantification::getStatus, STATUS_ENABLED)
|
||||
.eq(CreditScoreQuantification::getIsDeleted, 0)
|
||||
.orderByDesc(CreditScoreQuantification::getCreateTime))
|
||||
.stream().findFirst().orElse(null);
|
||||
}
|
||||
if (Func.isEmpty(quantification) || !Objects.equals(quantification.getStatus(), STATUS_ENABLED) || Objects.equals(quantification.getIsDeleted(), 1)) {
|
||||
throw new ServiceException("请先维护并启用评分量化表");
|
||||
}
|
||||
return quantification;
|
||||
}
|
||||
|
||||
private List<CustomerCreditScoreDetailVO> loadScoreTemplateDetails(Long quantificationId) {
|
||||
List<CreditScoreCategory> categories = categoryMapper.selectList(Wrappers.<CreditScoreCategory>lambdaQuery()
|
||||
.eq(CreditScoreCategory::getQuantificationId, quantificationId)
|
||||
.eq(CreditScoreCategory::getIsDeleted, 0)
|
||||
.orderByAsc(CreditScoreCategory::getSort));
|
||||
List<CreditScoreItem> items = itemMapper.selectList(Wrappers.<CreditScoreItem>lambdaQuery()
|
||||
.eq(CreditScoreItem::getQuantificationId, quantificationId)
|
||||
.eq(CreditScoreItem::getIsDeleted, 0)
|
||||
.orderByAsc(CreditScoreItem::getSort));
|
||||
List<CreditScoreItemOption> options = optionMapper.selectList(Wrappers.<CreditScoreItemOption>lambdaQuery()
|
||||
.eq(CreditScoreItemOption::getQuantificationId, quantificationId)
|
||||
.eq(CreditScoreItemOption::getIsDeleted, 0)
|
||||
.orderByAsc(CreditScoreItemOption::getSort));
|
||||
Map<Long, List<CreditScoreItemOption>> optionMap = options.stream().collect(Collectors.groupingBy(CreditScoreItemOption::getItemId));
|
||||
Map<Long, CreditScoreCategory> categoryMap = categories.stream().collect(Collectors.toMap(CreditScoreCategory::getId, category -> category));
|
||||
List<CustomerCreditScoreDetailVO> details = new ArrayList<>();
|
||||
for (CreditScoreItem item : items) {
|
||||
CreditScoreCategory category = categoryMap.get(item.getCategoryId());
|
||||
CustomerCreditScoreDetailVO detail = new CustomerCreditScoreDetailVO();
|
||||
detail.setQuantificationId(quantificationId);
|
||||
detail.setItemId(item.getId());
|
||||
detail.setCategoryCode(category == null ? item.getCategoryCode() : category.getCategoryCode());
|
||||
detail.setCategoryName(category == null ? item.getCategoryCode() : category.getCategoryName());
|
||||
detail.setItemName(item.getItemName());
|
||||
detail.setOptionDescription(item.getOptionDescription());
|
||||
detail.setScoreDescription(item.getScoreDescription());
|
||||
detail.setOptionsJson(buildOptionsJson(optionMap.getOrDefault(item.getId(), new ArrayList<>())));
|
||||
detail.setSelfScore(BigDecimal.ZERO);
|
||||
detail.setReviewScore(BigDecimal.ZERO);
|
||||
details.add(detail);
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
private String buildOptionsJson(List<CreditScoreItemOption> options) {
|
||||
List<Map<String, Object>> optionList = options.stream()
|
||||
.sorted(Comparator.comparing(CreditScoreItemOption::getSort, Comparator.nullsLast(Integer::compareTo)))
|
||||
.map(option -> {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("label", option.getOptionName());
|
||||
map.put("value", option.getOptionName());
|
||||
map.put("score", option.getScore());
|
||||
return map;
|
||||
}).toList();
|
||||
return JsonUtil.toJson(optionList);
|
||||
}
|
||||
|
||||
private String nextCustomerCode() {
|
||||
CustomerArchive latest = list(Wrappers.<CustomerArchive>lambdaQuery()
|
||||
.likeRight(CustomerArchive::getCustomerCode, CUSTOMER_CODE_PREFIX)
|
||||
.eq(CustomerArchive::getIsDeleted, 0)
|
||||
.orderByDesc(CustomerArchive::getCustomerCode))
|
||||
.stream().findFirst().orElse(null);
|
||||
int nextNumber = 1;
|
||||
if (Func.isNotEmpty(latest) && Func.isNotEmpty(latest.getCustomerCode())) {
|
||||
String number = latest.getCustomerCode().replace(CUSTOMER_CODE_PREFIX, "");
|
||||
if (number.matches("^\\d+$")) {
|
||||
nextNumber = Integer.parseInt(number) + 1;
|
||||
}
|
||||
}
|
||||
return CUSTOMER_CODE_PREFIX + String.format("%06d", nextNumber);
|
||||
}
|
||||
|
||||
private void addChangeRecord(Long customerId, String content) {
|
||||
CustomerChangeRecord record = new CustomerChangeRecord();
|
||||
record.setId(IdWorker.getId());
|
||||
record.setCustomerId(customerId);
|
||||
record.setChangeTime(LocalDateTime.now());
|
||||
record.setChangeContent(content);
|
||||
record.setChangeUserName(AuthUtil.getUserName());
|
||||
record.setStatus(STATUS_ENABLED);
|
||||
changeRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
private CustomerArchiveExcel buildExcel(CustomerArchive customer) {
|
||||
CustomerArchiveExcel excel = new CustomerArchiveExcel();
|
||||
excel.setCustomerCode(customer.getCustomerCode());
|
||||
excel.setShortName(customer.getShortName());
|
||||
excel.setFullName(customer.getFullName());
|
||||
excel.setCustomerType(customer.getCustomerType());
|
||||
excel.setCustomerNature(customer.getCustomerNature());
|
||||
excel.setUnifiedCreditCode(customer.getUnifiedCreditCode());
|
||||
excel.setDeptName(customer.getDeptName());
|
||||
excel.setAccessTypeName(accessTypeName(customer.getAccessType()));
|
||||
excel.setApprovalStatusName(approvalStatusName(customer.getApprovalStatus()));
|
||||
excel.setCurrentNode(customer.getCurrentNode());
|
||||
excel.setCurrentProcessor(customer.getCurrentProcessor());
|
||||
excel.setApprovedTime(customer.getApprovedTime());
|
||||
excel.setStatusName(Objects.equals(customer.getStatus(), STATUS_ENABLED) ? "启用" : "停用");
|
||||
excel.setCustomerLevel(customer.getCustomerLevel());
|
||||
excel.setMaxCreditLimit(customer.getMaxCreditLimit());
|
||||
excel.setApplyCreditLimit(customer.getApplyCreditLimit());
|
||||
excel.setContactPhone(customer.getContactPhone());
|
||||
excel.setLegalPerson(customer.getLegalPerson());
|
||||
excel.setCreateTime(customer.getCreateTime());
|
||||
return excel;
|
||||
}
|
||||
|
||||
private String accessTypeName(String accessType) {
|
||||
return Objects.equals(accessType, ACCESS_FORMAL) ? "正式" : "临时";
|
||||
}
|
||||
|
||||
private String approvalStatusName(String approvalStatus) {
|
||||
if (Objects.equals(approvalStatus, APPROVAL_REVIEWING)) {
|
||||
return "审核中";
|
||||
}
|
||||
if (Objects.equals(approvalStatus, APPROVAL_APPROVED)) {
|
||||
return "审核通过";
|
||||
}
|
||||
if (Objects.equals(approvalStatus, APPROVAL_REJECTED)) {
|
||||
return "审核不通过";
|
||||
}
|
||||
return "草稿";
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNonNegative(BigDecimal value, String message) {
|
||||
if (Func.isNotEmpty(value) && value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return Func.isEmpty(trimValue) ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.DriverExcel;
|
||||
import org.springblade.transport.mapper.DriverMapper;
|
||||
import org.springblade.transport.pojo.entity.Driver;
|
||||
import org.springblade.transport.pojo.vo.DriverExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.DriverVO;
|
||||
import org.springblade.transport.service.IDriverService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 司机管理 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> implements IDriverService {
|
||||
|
||||
private static final int NAME_MAX_LENGTH = 20;
|
||||
private static final int ID_CARD_MAX_LENGTH = 18;
|
||||
private static final int MOBILE_MAX_LENGTH = 20;
|
||||
private static final int SHORT_TEXT_MAX_LENGTH = 50;
|
||||
private static final int ADDRESS_MAX_LENGTH = 200;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int DEFAULT_ENABLED_STATUS = 1;
|
||||
private static final int DEFAULT_FALSE = 0;
|
||||
|
||||
@Override
|
||||
public IPage<DriverVO> selectDriverPage(IPage<DriverVO> page, DriverVO driver) {
|
||||
prepareQuery(driver);
|
||||
return page.setRecords(baseMapper.selectDriverPage(page, driver));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(Driver driver) {
|
||||
prepare(driver);
|
||||
validate(driver);
|
||||
checkUniqueIdCard(driver);
|
||||
return saveOrUpdate(driver);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean changeStatus(Long id, Integer status) {
|
||||
if (Func.isEmpty(id)) {
|
||||
throw new ServiceException("司机主键不能为空");
|
||||
}
|
||||
if (Func.isEmpty(status) || (status != 1 && status != 2)) {
|
||||
throw new ServiceException("状态值不正确");
|
||||
}
|
||||
Driver driver = new Driver();
|
||||
driver.setId(id);
|
||||
driver.setStatus(status);
|
||||
return updateById(driver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriverExpiryStatVO expiryStat(DriverVO driver) {
|
||||
prepareQuery(driver);
|
||||
driver.setExpireStatus(null);
|
||||
DriverExpiryStatVO stat = baseMapper.selectExpiryStat(driver);
|
||||
if (stat == null) {
|
||||
stat = new DriverExpiryStatVO();
|
||||
}
|
||||
stat.setTotal(defaultZero(stat.getTotal()));
|
||||
stat.setWithin30(defaultZero(stat.getWithin30()));
|
||||
stat.setExpired(defaultZero(stat.getExpired()));
|
||||
return stat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DriverExcel> exportDriver(Wrapper<Driver> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(driver -> {
|
||||
DriverExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(driver, DriverExcel.class));
|
||||
excel.setStatusName(driver.getStatus() != null && driver.getStatus() == 2 ? "停用" : "启用");
|
||||
excel.setDrivingLicenseLongTermName(driver.getDrivingLicenseLongTerm() != null && driver.getDrivingLicenseLongTerm() == 1 ? "是" : "否");
|
||||
excel.setQualificationLongTermName(driver.getQualificationLongTerm() != null && driver.getQualificationLongTerm() == 1 ? "是" : "否");
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepareQuery(DriverVO driver) {
|
||||
if (driver.getToday() == null) {
|
||||
driver.setToday(LocalDate.now());
|
||||
}
|
||||
if (driver.getWarningDate() == null) {
|
||||
driver.setWarningDate(driver.getToday().plusDays(30));
|
||||
}
|
||||
}
|
||||
|
||||
private void prepare(Driver driver) {
|
||||
driver.setDriverName(trimToEmpty(driver.getDriverName()));
|
||||
driver.setIdCardNo(trimToEmpty(driver.getIdCardNo()).toUpperCase());
|
||||
driver.setGender(trimToNull(driver.getGender()));
|
||||
driver.setNation(trimToNull(driver.getNation()));
|
||||
driver.setEducation(trimToNull(driver.getEducation()));
|
||||
driver.setAddressRegion(trimToNull(driver.getAddressRegion()));
|
||||
driver.setAddress(trimToNull(driver.getAddress()));
|
||||
driver.setPosts(trimToNull(driver.getPosts()));
|
||||
driver.setDrivingType(trimToEmpty(driver.getDrivingType()).toUpperCase());
|
||||
driver.setDrivingLicenseNo(trimToNull(driver.getDrivingLicenseNo()));
|
||||
driver.setQualificationType(trimToNull(driver.getQualificationType()));
|
||||
driver.setQualificationNo(trimToNull(driver.getQualificationNo()));
|
||||
driver.setDriverType(trimToEmpty(driver.getDriverType()));
|
||||
driver.setMobile(trimToEmpty(driver.getMobile()));
|
||||
driver.setContactRelation(trimToNull(driver.getContactRelation()));
|
||||
driver.setOrganizationName(trimToEmpty(driver.getOrganizationName()));
|
||||
driver.setEmergencyContactName(trimToEmpty(driver.getEmergencyContactName()));
|
||||
driver.setEmergencyContactMobile(trimToEmpty(driver.getEmergencyContactMobile()));
|
||||
driver.setRemark(trimToNull(driver.getRemark()));
|
||||
driver.setIdCardFront(trimToNull(driver.getIdCardFront()));
|
||||
driver.setIdCardBack(trimToNull(driver.getIdCardBack()));
|
||||
driver.setHeadPhoto(trimToNull(driver.getHeadPhoto()));
|
||||
driver.setDrivingLicenseFront(trimToNull(driver.getDrivingLicenseFront()));
|
||||
driver.setDrivingLicenseBack(trimToNull(driver.getDrivingLicenseBack()));
|
||||
driver.setQualificationFront(trimToNull(driver.getQualificationFront()));
|
||||
driver.setQualificationBack(trimToNull(driver.getQualificationBack()));
|
||||
if (driver.getDrivingLicenseLongTerm() == null) {
|
||||
driver.setDrivingLicenseLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (driver.getQualificationLongTerm() == null) {
|
||||
driver.setQualificationLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (driver.getStatus() == null) {
|
||||
driver.setStatus(DEFAULT_ENABLED_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(Driver driver) {
|
||||
if (Func.isEmpty(driver.getDriverName())) {
|
||||
throw new ServiceException("司机姓名不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getIdCardNo())) {
|
||||
throw new ServiceException("身份证号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDrivingType())) {
|
||||
throw new ServiceException("准驾车型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDriverType())) {
|
||||
throw new ServiceException("司机类型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getMobile())) {
|
||||
throw new ServiceException("手机号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getOrganizationName())) {
|
||||
throw new ServiceException("所属组织不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getEmergencyContactName())) {
|
||||
throw new ServiceException("紧急联系人姓名不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getEmergencyContactMobile())) {
|
||||
throw new ServiceException("紧急联系人手机号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getIdCardFront()) || Func.isEmpty(driver.getIdCardBack())) {
|
||||
throw new ServiceException("身份证正反面照片不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDrivingLicenseFront()) || Func.isEmpty(driver.getDrivingLicenseBack())) {
|
||||
throw new ServiceException("驾驶证主页和副页不能为空");
|
||||
}
|
||||
if (driver.getDrivingLicenseLongTerm() != 1 && Func.isEmpty(driver.getDrivingLicenseEndDate())) {
|
||||
throw new ServiceException("驾驶证有效期止不能为空");
|
||||
}
|
||||
if (driver.getQualificationLongTerm() != 1 && Func.isNotEmpty(driver.getQualificationNo()) && Func.isEmpty(driver.getQualificationEndDate())) {
|
||||
throw new ServiceException("从业资格证有效期止不能为空");
|
||||
}
|
||||
validateLength(driver.getDriverName(), NAME_MAX_LENGTH, "司机姓名不能超过20字");
|
||||
validateLength(driver.getIdCardNo(), ID_CARD_MAX_LENGTH, "身份证号不能超过18字");
|
||||
validateLength(driver.getMobile(), MOBILE_MAX_LENGTH, "手机号不能超过20字");
|
||||
validateLength(driver.getEmergencyContactMobile(), MOBILE_MAX_LENGTH, "紧急联系人手机号不能超过20字");
|
||||
validateLength(driver.getDrivingLicenseNo(), SHORT_TEXT_MAX_LENGTH, "驾驶证档案编号不能超过50字");
|
||||
validateLength(driver.getQualificationNo(), SHORT_TEXT_MAX_LENGTH, "资格证号不能超过50字");
|
||||
validateLength(driver.getOrganizationName(), SHORT_TEXT_MAX_LENGTH, "所属组织不能超过50字");
|
||||
validateLength(driver.getAddress(), ADDRESS_MAX_LENGTH, "详细地址不能超过200字");
|
||||
validateLength(driver.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
if (Func.isNotEmpty(driver.getDrivingLicenseStartDate()) && Func.isNotEmpty(driver.getDrivingLicenseEndDate()) && driver.getDrivingLicenseEndDate().isBefore(driver.getDrivingLicenseStartDate())) {
|
||||
throw new ServiceException("驾驶证有效期止不能早于有效期起");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUniqueIdCard(Driver driver) {
|
||||
Long count = count(Wrappers.<Driver>lambdaQuery()
|
||||
.eq(Driver::getIsDeleted, 0)
|
||||
.eq(Driver::getIdCardNo, driver.getIdCardNo())
|
||||
.ne(Func.isNotEmpty(driver.getId()), Driver::getId, driver.getId()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("身份证号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private Long defaultZero(Long value) {
|
||||
return value == null ? 0L : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.EtcRecordExcel;
|
||||
import org.springblade.transport.mapper.EtcRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.EtcRecord;
|
||||
import org.springblade.transport.pojo.vo.EtcRecordVO;
|
||||
import org.springblade.transport.service.IEtcRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* ETC记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class EtcRecordServiceImpl extends BaseServiceImpl<EtcRecordMapper, EtcRecord> implements IEtcRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int ETC_CARD_NO_MAX_LENGTH = 30;
|
||||
private static final int STATION_MAX_LENGTH = 50;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
|
||||
@Override
|
||||
public IPage<EtcRecordVO> selectEtcRecordPage(IPage<EtcRecordVO> page, EtcRecordVO etcRecord) {
|
||||
List<EtcRecordVO> records = baseMapper.selectEtcRecordPage(page, etcRecord);
|
||||
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
|
||||
return page.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(EtcRecord etcRecord) {
|
||||
prepare(etcRecord);
|
||||
validate(etcRecord);
|
||||
return saveOrUpdate(etcRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importEtcRecord(List<EtcRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
EtcRecord etcRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), EtcRecord.class));
|
||||
etcRecord.setDataSource("批量导入");
|
||||
submit(etcRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EtcRecordExcel> exportEtcRecord(Wrapper<EtcRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(etcRecord -> {
|
||||
EtcRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(etcRecord, EtcRecordExcel.class));
|
||||
excel.setTransactionAmount(nonNegative(etcRecord.getTransactionAmount()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(EtcRecord etcRecord) {
|
||||
etcRecord.setVehicleNo(trimToEmpty(etcRecord.getVehicleNo()).toUpperCase());
|
||||
etcRecord.setEtcCardNo(trimToNull(etcRecord.getEtcCardNo()));
|
||||
etcRecord.setEntryStation(trimToNull(etcRecord.getEntryStation()));
|
||||
etcRecord.setExitStation(trimToNull(etcRecord.getExitStation()));
|
||||
etcRecord.setDataSource(defaultDataSource(etcRecord.getDataSource()));
|
||||
etcRecord.setAttachments(trimToNull(etcRecord.getAttachments()));
|
||||
etcRecord.setRemark(trimToNull(etcRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(EtcRecord etcRecord) {
|
||||
if (Func.isEmpty(etcRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(etcRecord.getEtcCardNo())) {
|
||||
throw new ServiceException("ETC卡号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(etcRecord.getExitTime())) {
|
||||
throw new ServiceException("出口时间不能为空");
|
||||
}
|
||||
if (Func.isEmpty(etcRecord.getTransactionAmount())) {
|
||||
throw new ServiceException("交易金额不能为空");
|
||||
}
|
||||
if (Func.isNotEmpty(etcRecord.getEntryTime()) && !etcRecord.getExitTime().isAfter(etcRecord.getEntryTime())) {
|
||||
throw new ServiceException("出口时间应大于入口时间");
|
||||
}
|
||||
validateLength(etcRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号不能超过30字");
|
||||
validateLength(etcRecord.getEtcCardNo(), ETC_CARD_NO_MAX_LENGTH, "ETC卡号不能超过30字");
|
||||
validateLength(etcRecord.getEntryStation(), STATION_MAX_LENGTH, "入口站不能超过50字");
|
||||
validateLength(etcRecord.getExitStation(), STATION_MAX_LENGTH, "出口站不能超过50字");
|
||||
validateLength(etcRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(etcRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMoney(etcRecord.getTransactionAmount(), "交易金额");
|
||||
}
|
||||
|
||||
private void validateMoney(BigDecimal value, String fieldName) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > MONEY_SCALE) {
|
||||
throw new ServiceException(fieldName + "最多保留" + MONEY_SCALE + "位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String defaultDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
return value.isEmpty() ? "手工录入" : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.InsuranceRecordExcel;
|
||||
import org.springblade.transport.mapper.InsuranceRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.InsuranceRecord;
|
||||
import org.springblade.transport.pojo.vo.InsuranceRecordVO;
|
||||
import org.springblade.transport.service.IInsuranceRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 保险记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordMapper, InsuranceRecord> implements IInsuranceRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 50;
|
||||
private static final int INSURANCE_TYPE_MAX_LENGTH = 50;
|
||||
private static final int POLICY_NO_MAX_LENGTH = 80;
|
||||
private static final int INVOICE_NO_MAX_LENGTH = 80;
|
||||
private static final int OCR_TEMPLATE_MAX_LENGTH = 100;
|
||||
private static final int POLICY_FILE_MAX_LENGTH = 1000;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final Set<String> SUPPORT_FILE_TYPES = Set.of("jpg", "jpeg", "png", "pdf");
|
||||
|
||||
@Override
|
||||
public IPage<InsuranceRecordVO> selectInsuranceRecordPage(IPage<InsuranceRecordVO> page, InsuranceRecordVO insuranceRecord) {
|
||||
return page.setRecords(baseMapper.selectInsuranceRecordPage(page, insuranceRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(InsuranceRecord insuranceRecord) {
|
||||
prepare(insuranceRecord);
|
||||
validate(insuranceRecord);
|
||||
checkUniquePolicyNo(insuranceRecord);
|
||||
return saveOrUpdate(insuranceRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importInsuranceRecord(List<InsuranceRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
InsuranceRecord insuranceRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), InsuranceRecord.class));
|
||||
submit(insuranceRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InsuranceRecordExcel> exportInsuranceRecord(Wrapper<InsuranceRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(insuranceRecord -> {
|
||||
InsuranceRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(insuranceRecord, InsuranceRecordExcel.class));
|
||||
excel.setInsuredAmount(nonNegative(insuranceRecord.getInsuredAmount()));
|
||||
excel.setPremium(nonNegative(insuranceRecord.getPremium()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsuranceRecord recognizePolicy(MultipartFile file, String vehicleType, String ocrTemplate) {
|
||||
validatePolicyFile(file);
|
||||
InsuranceRecord insuranceRecord = new InsuranceRecord();
|
||||
insuranceRecord.setVehicleType(normalizeVehicleType(vehicleType));
|
||||
insuranceRecord.setOcrTemplate(trimToNull(ocrTemplate));
|
||||
throw new ServiceException("当前未配置OCR识别服务,请手动填写保单信息");
|
||||
}
|
||||
|
||||
private void prepare(InsuranceRecord insuranceRecord) {
|
||||
insuranceRecord.setVehicleType(normalizeVehicleType(insuranceRecord.getVehicleType()));
|
||||
insuranceRecord.setVehicleNo(trimToEmpty(insuranceRecord.getVehicleNo()).toUpperCase());
|
||||
insuranceRecord.setInsuranceType(trimToEmpty(insuranceRecord.getInsuranceType()));
|
||||
insuranceRecord.setPolicyNo(trimToEmpty(insuranceRecord.getPolicyNo()));
|
||||
insuranceRecord.setInvoiceNo(trimToNull(insuranceRecord.getInvoiceNo()));
|
||||
insuranceRecord.setOcrTemplate(trimToNull(insuranceRecord.getOcrTemplate()));
|
||||
insuranceRecord.setPolicyFile(trimToNull(insuranceRecord.getPolicyFile()));
|
||||
insuranceRecord.setRemark(trimToNull(insuranceRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(InsuranceRecord insuranceRecord) {
|
||||
if (Func.isEmpty(insuranceRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!"车辆".equals(insuranceRecord.getVehicleType()) && !"船舶".equals(insuranceRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号/船号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getInsuranceType())) {
|
||||
throw new ServiceException("保险类型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getPolicyNo())) {
|
||||
throw new ServiceException("保单号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getStartDate())) {
|
||||
throw new ServiceException("开始日期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getEndDate())) {
|
||||
throw new ServiceException("结束日期不能为空");
|
||||
}
|
||||
if (insuranceRecord.getEndDate().isBefore(insuranceRecord.getStartDate())) {
|
||||
throw new ServiceException("结束日期不能早于开始日期");
|
||||
}
|
||||
if (Func.isEmpty(insuranceRecord.getPremium())) {
|
||||
throw new ServiceException("保费不能为空");
|
||||
}
|
||||
validateNonNegative(insuranceRecord.getInsuredAmount(), "保额不能小于0");
|
||||
validateNonNegative(insuranceRecord.getPremium(), "保费不能小于0");
|
||||
validateLength(insuranceRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过50字");
|
||||
validateLength(insuranceRecord.getInsuranceType(), INSURANCE_TYPE_MAX_LENGTH, "保险类型不能超过50字");
|
||||
validateLength(insuranceRecord.getPolicyNo(), POLICY_NO_MAX_LENGTH, "保单号不能超过80字");
|
||||
validateLength(insuranceRecord.getInvoiceNo(), INVOICE_NO_MAX_LENGTH, "发票号不能超过80字");
|
||||
validateLength(insuranceRecord.getOcrTemplate(), OCR_TEMPLATE_MAX_LENGTH, "OCR识别模板不能超过100字");
|
||||
validateLength(insuranceRecord.getPolicyFile(), POLICY_FILE_MAX_LENGTH, "保单附件不能超过1000字");
|
||||
validateLength(insuranceRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
}
|
||||
|
||||
private void checkUniquePolicyNo(InsuranceRecord insuranceRecord) {
|
||||
Long count = count(Wrappers.<InsuranceRecord>lambdaQuery()
|
||||
.eq(InsuranceRecord::getIsDeleted, 0)
|
||||
.eq(InsuranceRecord::getVehicleType, insuranceRecord.getVehicleType())
|
||||
.eq(InsuranceRecord::getInsuranceType, insuranceRecord.getInsuranceType())
|
||||
.eq(InsuranceRecord::getPolicyNo, insuranceRecord.getPolicyNo())
|
||||
.ne(Func.isNotEmpty(insuranceRecord.getId()), InsuranceRecord::getId, insuranceRecord.getId()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("同一车船类型和保险类型下保单号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePolicyFile(MultipartFile file) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
throw new ServiceException("请上传保单图片或PDF文件");
|
||||
}
|
||||
String filename = file.getOriginalFilename();
|
||||
if (Func.isEmpty(filename) || !filename.contains(".")) {
|
||||
throw new ServiceException("文件格式不正确");
|
||||
}
|
||||
String extension = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
|
||||
if (!SUPPORT_FILE_TYPES.contains(extension)) {
|
||||
throw new ServiceException("仅支持JPG、PNG、PDF文件");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNonNegative(BigDecimal value, String message) {
|
||||
if (Func.isNotEmpty(value) && value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? "车辆" : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.MileageRecordExcel;
|
||||
import org.springblade.transport.mapper.MileageRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.MileageRecord;
|
||||
import org.springblade.transport.pojo.vo.MileageRecordVO;
|
||||
import org.springblade.transport.service.IMileageRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 里程记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class MileageRecordServiceImpl extends BaseServiceImpl<MileageRecordMapper, MileageRecord> implements IMileageRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MILEAGE_SCALE = 2;
|
||||
|
||||
@Override
|
||||
public IPage<MileageRecordVO> selectMileageRecordPage(IPage<MileageRecordVO> page, MileageRecordVO mileageRecord) {
|
||||
List<MileageRecordVO> records = baseMapper.selectMileageRecordPage(page, mileageRecord);
|
||||
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
|
||||
return page.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(MileageRecord mileageRecord) {
|
||||
prepare(mileageRecord);
|
||||
validate(mileageRecord);
|
||||
validateVehicleNoImmutable(mileageRecord);
|
||||
return saveOrUpdate(mileageRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importMileageRecord(List<MileageRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
MileageRecord mileageRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), MileageRecord.class));
|
||||
submit(mileageRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MileageRecordExcel> exportMileageRecord(Wrapper<MileageRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(mileageRecord -> {
|
||||
MileageRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(mileageRecord, MileageRecordExcel.class));
|
||||
excel.setPreviousMonthMileage(nonNegative(mileageRecord.getPreviousMonthMileage()));
|
||||
excel.setCurrentMonthMileage(nonNegative(mileageRecord.getCurrentMonthMileage()));
|
||||
excel.setMonthlyMileage(nonNegative(mileageRecord.getMonthlyMileage()));
|
||||
excel.setTotalMileage(nonNegative(mileageRecord.getTotalMileage()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(MileageRecord mileageRecord) {
|
||||
mileageRecord.setVehicleNo(trimToEmpty(mileageRecord.getVehicleNo()).toUpperCase());
|
||||
mileageRecord.setRemark(trimToNull(mileageRecord.getRemark()));
|
||||
mileageRecord.setAttachments(trimToNull(mileageRecord.getAttachments()));
|
||||
if (mileageRecord.getMonthlyMileage() == null
|
||||
&& mileageRecord.getPreviousMonthMileage() != null
|
||||
&& mileageRecord.getCurrentMonthMileage() != null) {
|
||||
mileageRecord.setMonthlyMileage(mileageRecord.getCurrentMonthMileage().subtract(mileageRecord.getPreviousMonthMileage()));
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(MileageRecord mileageRecord) {
|
||||
if (Func.isEmpty(mileageRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号不能为空");
|
||||
}
|
||||
validateLength(mileageRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号不能超过30字");
|
||||
validateLength(mileageRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(mileageRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMileage(mileageRecord.getPreviousMonthMileage(), "上月统计里程");
|
||||
validateMileage(mileageRecord.getCurrentMonthMileage(), "本月统计里程");
|
||||
validateMileage(mileageRecord.getMonthlyMileage(), "本月行驶里程");
|
||||
validateMileage(mileageRecord.getTotalMileage(), "累计行驶里程");
|
||||
validateMonthlyMileageConsistency(mileageRecord);
|
||||
if (mileageRecord.getTotalMileage() != null
|
||||
&& mileageRecord.getCurrentMonthMileage() != null
|
||||
&& mileageRecord.getTotalMileage().compareTo(mileageRecord.getCurrentMonthMileage()) < 0) {
|
||||
throw new ServiceException("累计行驶里程应大于等于本月统计里程");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMonthlyMileageConsistency(MileageRecord mileageRecord) {
|
||||
if (mileageRecord.getPreviousMonthMileage() == null
|
||||
|| mileageRecord.getCurrentMonthMileage() == null
|
||||
|| mileageRecord.getMonthlyMileage() == null) {
|
||||
return;
|
||||
}
|
||||
BigDecimal calculated = mileageRecord.getCurrentMonthMileage().subtract(mileageRecord.getPreviousMonthMileage());
|
||||
if (calculated.compareTo(mileageRecord.getMonthlyMileage()) != 0) {
|
||||
throw new ServiceException("本月行驶里程应等于本月统计里程减去上月统计里程");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateVehicleNoImmutable(MileageRecord mileageRecord) {
|
||||
if (Func.isEmpty(mileageRecord.getId())) {
|
||||
return;
|
||||
}
|
||||
MileageRecord oldRecord = getById(mileageRecord.getId());
|
||||
if (oldRecord != null && Func.isNotEmpty(oldRecord.getVehicleNo()) && !oldRecord.getVehicleNo().equals(mileageRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号保存后不可修改");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMileage(BigDecimal value, String fieldName) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > MILEAGE_SCALE) {
|
||||
throw new ServiceException(fieldName + "最多保留2位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.OilElectricRecordExcel;
|
||||
import org.springblade.transport.mapper.OilElectricRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.OilElectricRecord;
|
||||
import org.springblade.transport.pojo.vo.OilElectricRecordVO;
|
||||
import org.springblade.transport.service.IOilElectricRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 油电记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class OilElectricRecordServiceImpl extends BaseServiceImpl<OilElectricRecordMapper, OilElectricRecord> implements IOilElectricRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int CARD_NO_MAX_LENGTH = 30;
|
||||
private static final int CARD_HOLDER_MAX_LENGTH = 20;
|
||||
private static final int OIL_PRODUCT_MAX_LENGTH = 50;
|
||||
private static final int STATION_MAX_LENGTH = 50;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
private static final int QUANTITY_SCALE = 2;
|
||||
private static final String VEHICLE = "车辆";
|
||||
private static final String SHIP = "船舶";
|
||||
private static final String FUEL = "加油";
|
||||
private static final String ELECTRIC = "充电";
|
||||
private static final Set<String> FEE_TYPES = Set.of(FUEL, ELECTRIC);
|
||||
|
||||
@Override
|
||||
public IPage<OilElectricRecordVO> selectOilElectricRecordPage(IPage<OilElectricRecordVO> page, OilElectricRecordVO oilElectricRecord) {
|
||||
List<OilElectricRecordVO> records = baseMapper.selectOilElectricRecordPage(page, oilElectricRecord);
|
||||
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
|
||||
return page.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(OilElectricRecord oilElectricRecord) {
|
||||
prepare(oilElectricRecord);
|
||||
validate(oilElectricRecord);
|
||||
return saveOrUpdate(oilElectricRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importOilElectricRecord(List<OilElectricRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
OilElectricRecord oilElectricRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), OilElectricRecord.class));
|
||||
oilElectricRecord.setDataSource(defaultDataSource(oilElectricRecord.getDataSource()));
|
||||
submit(oilElectricRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OilElectricRecordExcel> exportOilElectricRecord(Wrapper<OilElectricRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(oilElectricRecord -> {
|
||||
OilElectricRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(oilElectricRecord, OilElectricRecordExcel.class));
|
||||
excel.setQuantity(nonNegative(oilElectricRecord.getQuantity()));
|
||||
excel.setUnitPrice(nonNegative(oilElectricRecord.getUnitPrice()));
|
||||
excel.setTransactionAmount(nonNegative(oilElectricRecord.getTransactionAmount()));
|
||||
excel.setBalance(nonNegative(oilElectricRecord.getBalance()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(OilElectricRecord oilElectricRecord) {
|
||||
oilElectricRecord.setVehicleType(normalizeVehicleType(oilElectricRecord.getVehicleType()));
|
||||
oilElectricRecord.setVehicleNo(trimToEmpty(oilElectricRecord.getVehicleNo()));
|
||||
if (VEHICLE.equals(oilElectricRecord.getVehicleType())) {
|
||||
oilElectricRecord.setVehicleNo(oilElectricRecord.getVehicleNo().toUpperCase());
|
||||
}
|
||||
oilElectricRecord.setFeeType(trimToNull(oilElectricRecord.getFeeType()));
|
||||
oilElectricRecord.setOilProduct(trimToNull(oilElectricRecord.getOilProduct()));
|
||||
oilElectricRecord.setCardNo(trimToNull(oilElectricRecord.getCardNo()));
|
||||
oilElectricRecord.setCardHolder(trimToNull(oilElectricRecord.getCardHolder()));
|
||||
oilElectricRecord.setStation(trimToNull(oilElectricRecord.getStation()));
|
||||
oilElectricRecord.setDataSource(defaultDataSource(oilElectricRecord.getDataSource()));
|
||||
oilElectricRecord.setAttachments(trimToNull(oilElectricRecord.getAttachments()));
|
||||
oilElectricRecord.setRemark(trimToNull(oilElectricRecord.getRemark()));
|
||||
if (ELECTRIC.equals(oilElectricRecord.getFeeType())) {
|
||||
oilElectricRecord.setOilProduct(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(OilElectricRecord oilElectricRecord) {
|
||||
if (Func.isEmpty(oilElectricRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!VEHICLE.equals(oilElectricRecord.getVehicleType()) && !SHIP.equals(oilElectricRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(oilElectricRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号/船号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(oilElectricRecord.getTransactionTime())) {
|
||||
throw new ServiceException("交易时间不能为空");
|
||||
}
|
||||
if (Func.isEmpty(oilElectricRecord.getFeeType())) {
|
||||
throw new ServiceException("费用类型不能为空");
|
||||
}
|
||||
if (!FEE_TYPES.contains(oilElectricRecord.getFeeType())) {
|
||||
throw new ServiceException("费用类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(oilElectricRecord.getTransactionAmount())) {
|
||||
throw new ServiceException("交易金额不能为空");
|
||||
}
|
||||
validateLength(oilElectricRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(oilElectricRecord.getCardNo(), CARD_NO_MAX_LENGTH, "卡号不能超过30字");
|
||||
validateLength(oilElectricRecord.getCardHolder(), CARD_HOLDER_MAX_LENGTH, "持卡人不能超过20字");
|
||||
validateLength(oilElectricRecord.getOilProduct(), OIL_PRODUCT_MAX_LENGTH, "油品不能超过50字");
|
||||
validateLength(oilElectricRecord.getStation(), STATION_MAX_LENGTH, "站点不能超过50字");
|
||||
validateLength(oilElectricRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(oilElectricRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMoney(oilElectricRecord.getTransactionAmount(), "交易金额");
|
||||
validateMoney(oilElectricRecord.getUnitPrice(), "单价");
|
||||
validateMoney(oilElectricRecord.getBalance(), "余额");
|
||||
validateNumber(oilElectricRecord.getQuantity(), "数量", QUANTITY_SCALE);
|
||||
}
|
||||
|
||||
private void validateMoney(BigDecimal value, String fieldName) {
|
||||
validateNumber(value, fieldName, MONEY_SCALE);
|
||||
}
|
||||
|
||||
private void validateNumber(BigDecimal value, String fieldName, int scale) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > scale) {
|
||||
throw new ServiceException(fieldName + "最多保留" + scale + "位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String defaultDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
return value.isEmpty() ? "手工录入" : value;
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? VEHICLE : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.OtherExpenseRecordExcel;
|
||||
import org.springblade.transport.mapper.OtherExpenseRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.OtherExpenseRecord;
|
||||
import org.springblade.transport.pojo.vo.OtherExpenseRecordVO;
|
||||
import org.springblade.transport.service.IOtherExpenseRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 其他费用记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class OtherExpenseRecordServiceImpl extends BaseServiceImpl<OtherExpenseRecordMapper, OtherExpenseRecord> implements IOtherExpenseRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
private static final String VEHICLE = "车辆";
|
||||
private static final String SHIP = "船舶";
|
||||
private static final Set<String> EXPENSE_TYPES = Set.of("过路费", "停车费", "维修费", "保险费", "年检费", "装卸费", "其他");
|
||||
|
||||
@Override
|
||||
public IPage<OtherExpenseRecordVO> selectOtherExpenseRecordPage(IPage<OtherExpenseRecordVO> page, OtherExpenseRecordVO otherExpenseRecord) {
|
||||
List<OtherExpenseRecordVO> records = baseMapper.selectOtherExpenseRecordPage(page, otherExpenseRecord);
|
||||
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
|
||||
return page.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(OtherExpenseRecord otherExpenseRecord) {
|
||||
prepare(otherExpenseRecord);
|
||||
validate(otherExpenseRecord);
|
||||
return saveOrUpdate(otherExpenseRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importOtherExpenseRecord(List<OtherExpenseRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
OtherExpenseRecord otherExpenseRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), OtherExpenseRecord.class));
|
||||
otherExpenseRecord.setDataSource("批量导入");
|
||||
submit(otherExpenseRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OtherExpenseRecordExcel> exportOtherExpenseRecord(Wrapper<OtherExpenseRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(otherExpenseRecord -> {
|
||||
OtherExpenseRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(otherExpenseRecord, OtherExpenseRecordExcel.class));
|
||||
excel.setAmount(nonNegative(otherExpenseRecord.getAmount()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(OtherExpenseRecord otherExpenseRecord) {
|
||||
if (Func.isEmpty(otherExpenseRecord.getExpenseDate())) {
|
||||
otherExpenseRecord.setExpenseDate(LocalDate.now());
|
||||
}
|
||||
otherExpenseRecord.setExpenseType(trimToNull(otherExpenseRecord.getExpenseType()));
|
||||
otherExpenseRecord.setVehicleType(normalizeVehicleType(otherExpenseRecord.getVehicleType()));
|
||||
otherExpenseRecord.setVehicleNo(trimToEmpty(otherExpenseRecord.getVehicleNo()));
|
||||
if (VEHICLE.equals(otherExpenseRecord.getVehicleType())) {
|
||||
otherExpenseRecord.setVehicleNo(otherExpenseRecord.getVehicleNo().toUpperCase());
|
||||
}
|
||||
otherExpenseRecord.setDataSource(defaultDataSource(otherExpenseRecord.getDataSource()));
|
||||
otherExpenseRecord.setAttachments(trimToNull(otherExpenseRecord.getAttachments()));
|
||||
otherExpenseRecord.setRemark(trimToNull(otherExpenseRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(OtherExpenseRecord otherExpenseRecord) {
|
||||
if (Func.isEmpty(otherExpenseRecord.getExpenseDate())) {
|
||||
throw new ServiceException("费用日期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(otherExpenseRecord.getExpenseType())) {
|
||||
throw new ServiceException("费用类型不能为空");
|
||||
}
|
||||
if (!EXPENSE_TYPES.contains(otherExpenseRecord.getExpenseType())) {
|
||||
throw new ServiceException("费用类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(otherExpenseRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!VEHICLE.equals(otherExpenseRecord.getVehicleType()) && !SHIP.equals(otherExpenseRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(otherExpenseRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号/船号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(otherExpenseRecord.getAmount())) {
|
||||
throw new ServiceException("金额不能为空");
|
||||
}
|
||||
validateLength(otherExpenseRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(otherExpenseRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(otherExpenseRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validateMoney(otherExpenseRecord.getAmount(), "金额");
|
||||
}
|
||||
|
||||
private void validateMoney(BigDecimal value, String fieldName) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
if (value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(fieldName + "不能小于0");
|
||||
}
|
||||
if (value.stripTrailingZeros().scale() > MONEY_SCALE) {
|
||||
throw new ServiceException(fieldName + "最多保留" + MONEY_SCALE + "位小数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private String defaultDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
return value.isEmpty() ? "手工录入" : value;
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? VEHICLE : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TireReplacementRecordExcel;
|
||||
import org.springblade.transport.mapper.TireReplacementRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.TireReplacementRecord;
|
||||
import org.springblade.transport.pojo.vo.TireReplacementRecordVO;
|
||||
import org.springblade.transport.service.ITireReplacementRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 换胎记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class TireReplacementRecordServiceImpl extends BaseServiceImpl<TireReplacementRecordMapper, TireReplacementRecord> implements ITireReplacementRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int HANDLER_MAX_LENGTH = 20;
|
||||
private static final int TIRE_BRAND_MAX_LENGTH = 50;
|
||||
private static final int DESCRIPTION_MAX_LENGTH = 200;
|
||||
private static final int REMARK_MAX_LENGTH = 500;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final int MONEY_SCALE = 2;
|
||||
|
||||
@Override
|
||||
public IPage<TireReplacementRecordVO> selectTireReplacementRecordPage(IPage<TireReplacementRecordVO> page, TireReplacementRecordVO tireReplacementRecord) {
|
||||
return page.setRecords(baseMapper.selectTireReplacementRecordPage(page, tireReplacementRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(TireReplacementRecord tireReplacementRecord) {
|
||||
prepare(tireReplacementRecord);
|
||||
validate(tireReplacementRecord);
|
||||
return saveOrUpdate(tireReplacementRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importTireReplacementRecord(List<TireReplacementRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
TireReplacementRecord tireReplacementRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), TireReplacementRecord.class));
|
||||
submit(tireReplacementRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TireReplacementRecordExcel> exportTireReplacementRecord(Wrapper<TireReplacementRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(tireReplacementRecord -> {
|
||||
TireReplacementRecordExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(tireReplacementRecord, TireReplacementRecordExcel.class));
|
||||
excel.setTireQuantity(validQuantity(tireReplacementRecord.getTireQuantity()));
|
||||
excel.setReplacementCost(nonNegative(tireReplacementRecord.getReplacementCost()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepare(TireReplacementRecord tireReplacementRecord) {
|
||||
tireReplacementRecord.setVehicleNo(trimToEmpty(tireReplacementRecord.getVehicleNo()).toUpperCase());
|
||||
tireReplacementRecord.setHandler(trimToNull(tireReplacementRecord.getHandler()));
|
||||
tireReplacementRecord.setTireBrand(trimToNull(tireReplacementRecord.getTireBrand()));
|
||||
tireReplacementRecord.setReplacementDescription(trimToNull(tireReplacementRecord.getReplacementDescription()));
|
||||
tireReplacementRecord.setAttachments(trimToNull(tireReplacementRecord.getAttachments()));
|
||||
tireReplacementRecord.setRemark(trimToNull(tireReplacementRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(TireReplacementRecord tireReplacementRecord) {
|
||||
if (Func.isEmpty(tireReplacementRecord.getVehicleNo())) {
|
||||
throw new ServiceException("车牌号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(tireReplacementRecord.getReplacementTime())) {
|
||||
throw new ServiceException("换胎时间不能为空");
|
||||
}
|
||||
if (Func.isEmpty(tireReplacementRecord.getReplacementCost())) {
|
||||
throw new ServiceException("换胎费用不能为空");
|
||||
}
|
||||
validateLength(tireReplacementRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号不能超过30字");
|
||||
validateLength(tireReplacementRecord.getHandler(), HANDLER_MAX_LENGTH, "处理人不能超过20字");
|
||||
validateLength(tireReplacementRecord.getTireBrand(), TIRE_BRAND_MAX_LENGTH, "轮胎品牌不能超过50字");
|
||||
validateLength(tireReplacementRecord.getReplacementDescription(), DESCRIPTION_MAX_LENGTH, "换胎说明不能超过200字");
|
||||
validateLength(tireReplacementRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过500字");
|
||||
validateLength(tireReplacementRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
validatePositiveInteger(tireReplacementRecord.getTireQuantity());
|
||||
validateNonNegative(tireReplacementRecord.getReplacementCost(), "换胎费用不能小于0");
|
||||
validateScale(tireReplacementRecord.getReplacementCost(), "换胎费用最多保留2位小数");
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePositiveInteger(Integer value) {
|
||||
if (Func.isNotEmpty(value) && value <= 0) {
|
||||
throw new ServiceException("换胎数量必须为正整数");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNonNegative(BigDecimal value, String message) {
|
||||
if (Func.isNotEmpty(value) && value.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateScale(BigDecimal value, String message) {
|
||||
if (Func.isNotEmpty(value) && value.stripTrailingZeros().scale() > MONEY_SCALE) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal nonNegative(BigDecimal value) {
|
||||
if (Func.isEmpty(value) || value.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
return value;
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private Integer validQuantity(Integer value) {
|
||||
if (Func.isEmpty(value) || value > 0) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.TransportChangeRecordExcel;
|
||||
import org.springblade.transport.mapper.TransportChangeRecordMapper;
|
||||
import org.springblade.transport.pojo.entity.TransportChangeRecord;
|
||||
import org.springblade.transport.pojo.vo.TransportChangeRecordVO;
|
||||
import org.springblade.transport.service.ITransportChangeRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 变更记录 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class TransportChangeRecordServiceImpl extends BaseServiceImpl<TransportChangeRecordMapper, TransportChangeRecord> implements ITransportChangeRecordService {
|
||||
|
||||
private static final int VEHICLE_NO_MAX_LENGTH = 30;
|
||||
private static final int CHANGE_CONTENT_MAX_LENGTH = 200;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
|
||||
private static final String VEHICLE = "车辆";
|
||||
private static final String SHIP = "船舶";
|
||||
private static final Set<String> CHANGE_ITEMS = Set.of("所有人变更", "挂靠变更", "经营范围变更", "车牌号变更", "其他");
|
||||
|
||||
@Override
|
||||
public IPage<TransportChangeRecordVO> selectTransportChangeRecordPage(IPage<TransportChangeRecordVO> page, TransportChangeRecordVO transportChangeRecord) {
|
||||
List<TransportChangeRecordVO> records = baseMapper.selectTransportChangeRecordPage(page, transportChangeRecord);
|
||||
records.forEach(record -> record.setUpdateUserName(UserCache.getUserRealName(record.getUpdateUser())));
|
||||
return page.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(TransportChangeRecord transportChangeRecord) {
|
||||
prepare(transportChangeRecord);
|
||||
validate(transportChangeRecord);
|
||||
return saveOrUpdate(transportChangeRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importTransportChangeRecord(List<TransportChangeRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
List<String> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
try {
|
||||
TransportChangeRecord transportChangeRecord = Objects.requireNonNull(BeanUtil.copyProperties(data.get(index), TransportChangeRecord.class));
|
||||
submit(transportChangeRecord);
|
||||
} catch (Exception exception) {
|
||||
errorList.add("第" + (index + 2) + "行:" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (Func.isNotEmpty(errorList)) {
|
||||
throw new ServiceException(String.join(";", errorList));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportChangeRecordExcel> exportTransportChangeRecord(Wrapper<TransportChangeRecord> queryWrapper) {
|
||||
return list(queryWrapper).stream()
|
||||
.map(transportChangeRecord -> Objects.requireNonNull(BeanUtil.copyProperties(transportChangeRecord, TransportChangeRecordExcel.class)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private void prepare(TransportChangeRecord transportChangeRecord) {
|
||||
transportChangeRecord.setVehicleType(normalizeVehicleType(transportChangeRecord.getVehicleType()));
|
||||
transportChangeRecord.setVehicleNo(trimToNull(transportChangeRecord.getVehicleNo()));
|
||||
if (Func.isNotEmpty(transportChangeRecord.getVehicleNo()) && VEHICLE.equals(transportChangeRecord.getVehicleType())) {
|
||||
transportChangeRecord.setVehicleNo(transportChangeRecord.getVehicleNo().toUpperCase());
|
||||
}
|
||||
transportChangeRecord.setChangeItem(trimToNull(transportChangeRecord.getChangeItem()));
|
||||
transportChangeRecord.setChangeContent(trimToNull(transportChangeRecord.getChangeContent()));
|
||||
transportChangeRecord.setAttachments(trimToNull(transportChangeRecord.getAttachments()));
|
||||
transportChangeRecord.setRemark(trimToNull(transportChangeRecord.getRemark()));
|
||||
}
|
||||
|
||||
private void validate(TransportChangeRecord transportChangeRecord) {
|
||||
if (Func.isEmpty(transportChangeRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不能为空");
|
||||
}
|
||||
if (!VEHICLE.equals(transportChangeRecord.getVehicleType()) && !SHIP.equals(transportChangeRecord.getVehicleType())) {
|
||||
throw new ServiceException("车船类型不正确");
|
||||
}
|
||||
if (Func.isEmpty(transportChangeRecord.getChangeItem())) {
|
||||
throw new ServiceException("变更事项不能为空");
|
||||
}
|
||||
if (!CHANGE_ITEMS.contains(transportChangeRecord.getChangeItem())) {
|
||||
throw new ServiceException("变更事项不正确");
|
||||
}
|
||||
if (Func.isEmpty(transportChangeRecord.getChangeContent())) {
|
||||
throw new ServiceException("变更内容不能为空");
|
||||
}
|
||||
validateLength(transportChangeRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(transportChangeRecord.getChangeContent(), CHANGE_CONTENT_MAX_LENGTH, "变更内容不能超过200字");
|
||||
validateLength(transportChangeRecord.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateLength(transportChangeRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private String normalizeVehicleType(String vehicleType) {
|
||||
String value = trimToEmpty(vehicleType);
|
||||
return value.isEmpty() ? VEHICLE : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.transport.excel.TransportShipExcel;
|
||||
import org.springblade.transport.mapper.TransportShipMapper;
|
||||
import org.springblade.transport.pojo.entity.TransportShip;
|
||||
import org.springblade.transport.pojo.vo.TransportShipExpiryStatVO;
|
||||
import org.springblade.transport.pojo.vo.TransportShipVO;
|
||||
import org.springblade.transport.service.ITransportShipService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 船舶管理 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMapper, TransportShip> implements ITransportShipService {
|
||||
|
||||
private static final int NAME_MAX_LENGTH = 50;
|
||||
private static final int SHORT_TEXT_MAX_LENGTH = 50;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int DEFAULT_ENABLED_STATUS = 1;
|
||||
private static final int DEFAULT_FALSE = 0;
|
||||
|
||||
@Override
|
||||
public IPage<TransportShipVO> selectTransportShipPage(IPage<TransportShipVO> page, TransportShipVO ship) {
|
||||
prepareQuery(ship);
|
||||
return page.setRecords(baseMapper.selectTransportShipPage(page, ship));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(TransportShip ship) {
|
||||
prepare(ship);
|
||||
validate(ship);
|
||||
checkUniqueIdentifier(ship);
|
||||
return saveOrUpdate(ship);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean changeStatus(Long id, Integer status) {
|
||||
if (Func.isEmpty(id)) {
|
||||
throw new ServiceException("船舶主键不能为空");
|
||||
}
|
||||
if (Func.isEmpty(status) || (status != 1 && status != 2)) {
|
||||
throw new ServiceException("状态值不正确");
|
||||
}
|
||||
TransportShip ship = new TransportShip();
|
||||
ship.setId(id);
|
||||
ship.setStatus(status);
|
||||
return updateById(ship);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransportShipExpiryStatVO expiryStat(TransportShipVO ship) {
|
||||
prepareQuery(ship);
|
||||
ship.setExpireStatus(null);
|
||||
TransportShipExpiryStatVO stat = baseMapper.selectExpiryStat(ship);
|
||||
if (stat == null) {
|
||||
stat = new TransportShipExpiryStatVO();
|
||||
}
|
||||
stat.setTotal(defaultZero(stat.getTotal()));
|
||||
stat.setWithin30(defaultZero(stat.getWithin30()));
|
||||
stat.setExpired(defaultZero(stat.getExpired()));
|
||||
return stat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportShipExcel> exportTransportShip(Wrapper<TransportShip> queryWrapper) {
|
||||
return list(queryWrapper).stream().map(ship -> {
|
||||
TransportShipExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(ship, TransportShipExcel.class));
|
||||
excel.setStatusName(ship.getStatus() != null && ship.getStatus() == 2 ? "停用" : "启用");
|
||||
excel.setNationalityCertLongTermName(yesNo(ship.getNationalityCertLongTerm()));
|
||||
excel.setSafeManningCertLongTermName(yesNo(ship.getSafeManningCertLongTerm()));
|
||||
excel.setBusinessTransportCertLongTermName(yesNo(ship.getBusinessTransportCertLongTerm()));
|
||||
excel.setLeaseLongTermName(yesNo(ship.getLeaseLongTerm()));
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private void prepareQuery(TransportShipVO ship) {
|
||||
if (ship.getToday() == null) {
|
||||
ship.setToday(LocalDate.now());
|
||||
}
|
||||
if (ship.getWarningDate() == null) {
|
||||
ship.setWarningDate(ship.getToday().plusDays(30));
|
||||
}
|
||||
}
|
||||
|
||||
private void prepare(TransportShip ship) {
|
||||
ship.setShipName(trimToEmpty(ship.getShipName()));
|
||||
ship.setShipIdentifierNo(trimToEmpty(ship.getShipIdentifierNo()).toUpperCase());
|
||||
ship.setOrganizationName(trimToEmpty(ship.getOrganizationName()));
|
||||
ship.setShipInspectionNo(trimToNull(ship.getShipInspectionNo()));
|
||||
ship.setShipType(trimToEmpty(ship.getShipType()));
|
||||
ship.setNationalityCertImage(trimToNull(ship.getNationalityCertImage()));
|
||||
ship.setSafeManningCertImage(trimToNull(ship.getSafeManningCertImage()));
|
||||
ship.setBusinessTransportCertImage(trimToNull(ship.getBusinessTransportCertImage()));
|
||||
ship.setLeaseContractImage(trimToNull(ship.getLeaseContractImage()));
|
||||
ship.setRemark(trimToNull(ship.getRemark()));
|
||||
if (ship.getNationalityCertLongTerm() == null) {
|
||||
ship.setNationalityCertLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (ship.getSafeManningCertLongTerm() == null) {
|
||||
ship.setSafeManningCertLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (ship.getBusinessTransportCertLongTerm() == null) {
|
||||
ship.setBusinessTransportCertLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (ship.getLeaseLongTerm() == null) {
|
||||
ship.setLeaseLongTerm(DEFAULT_FALSE);
|
||||
}
|
||||
if (ship.getStatus() == null) {
|
||||
ship.setStatus(DEFAULT_ENABLED_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(TransportShip ship) {
|
||||
if (Func.isEmpty(ship.getShipName())) {
|
||||
throw new ServiceException("船舶名不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getShipIdentifierNo())) {
|
||||
throw new ServiceException("船舶识别号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getOrganizationName())) {
|
||||
throw new ServiceException("所属组织不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getShipType())) {
|
||||
throw new ServiceException("船舶类型不能为空");
|
||||
}
|
||||
if (ship.getNationalityCertLongTerm() != 1 && Func.isEmpty(ship.getNationalityCertEndDate())) {
|
||||
throw new ServiceException("国籍证有效期至不能为空");
|
||||
}
|
||||
if (ship.getSafeManningCertLongTerm() != 1 && Func.isEmpty(ship.getSafeManningCertEndDate())) {
|
||||
throw new ServiceException("最低安全配员证书有效期至不能为空");
|
||||
}
|
||||
if (ship.getBusinessTransportCertLongTerm() != 1 && Func.isEmpty(ship.getBusinessTransportCertEndDate())) {
|
||||
throw new ServiceException("营业运输证有效期至不能为空");
|
||||
}
|
||||
validateLength(ship.getShipName(), NAME_MAX_LENGTH, "船舶名不能超过50字");
|
||||
validateLength(ship.getShipIdentifierNo(), SHORT_TEXT_MAX_LENGTH, "船舶识别号不能超过50字");
|
||||
validateLength(ship.getOrganizationName(), NAME_MAX_LENGTH, "所属组织不能超过50字");
|
||||
validateLength(ship.getShipInspectionNo(), SHORT_TEXT_MAX_LENGTH, "船检登记号不能超过50字");
|
||||
validateLength(ship.getShipType(), SHORT_TEXT_MAX_LENGTH, "船舶类型不能超过50字");
|
||||
validateLength(ship.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
}
|
||||
|
||||
private void checkUniqueIdentifier(TransportShip ship) {
|
||||
Long count = count(Wrappers.<TransportShip>lambdaQuery()
|
||||
.eq(TransportShip::getIsDeleted, 0)
|
||||
.eq(TransportShip::getShipIdentifierNo, ship.getShipIdentifierNo())
|
||||
.ne(Func.isNotEmpty(ship.getId()), TransportShip::getId, ship.getId()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("船舶识别号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLength(String value, int maxLength, String message) {
|
||||
if (Func.isNotEmpty(value) && value.length() > maxLength) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private Long defaultZero(Long value) {
|
||||
return value == null ? 0L : value;
|
||||
}
|
||||
|
||||
private String yesNo(Integer value) {
|
||||
return value != null && value == 1 ? "是" : "否";
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String trimToNull(String value) {
|
||||
String trimValue = trimToEmpty(value);
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user