From 6f846611151fcc2b84dea44f2d9d31e11f19e362 Mon Sep 17 00:00:00 2001 From: makuning Date: Mon, 10 Jul 2023 17:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E6=B1=BD=E8=BD=A6?= =?UTF-8?q?=E5=87=BA=E7=A7=9F=E3=80=81=E5=87=BA=E7=A7=9F=E8=BD=A6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=80=81=E6=B1=BD=E8=BD=A6=E5=85=A5=E5=BA=93=E3=80=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=8D=95=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/insectmk/bus/mapper/CarMapper.java | 20 +++ .../cn/insectmk/bus/mapper/CheckMapper.java | 20 +++ .../insectmk/bus/mapper/CustomerMapper.java | 24 ++++ .../cn/insectmk/bus/mapper/RentMapper.java | 23 ++++ .../cn/insectmk/bus/service/CarService.java | 52 ++++++++ .../cn/insectmk/bus/service/CheckService.java | 50 +++++++ .../insectmk/bus/service/CustomerService.java | 51 ++++++++ .../cn/insectmk/bus/service/RentService.java | 42 ++++++ .../bus/service/impl/CarServiceImpl.java | 88 +++++++++++++ .../bus/service/impl/CheckServiceImpl.java | 123 ++++++++++++++++++ .../bus/service/impl/CustomerServiceImpl.java | 87 +++++++++++++ .../bus/service/impl/RentServiceImpl.java | 71 ++++++++++ 12 files changed, 651 insertions(+) create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CarMapper.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CheckMapper.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CustomerMapper.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/RentMapper.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/CarService.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/CheckService.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/CustomerService.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/RentService.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CarServiceImpl.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CheckServiceImpl.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CustomerServiceImpl.java create mode 100644 fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/RentServiceImpl.java diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CarMapper.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CarMapper.java new file mode 100644 index 0000000..faff80e --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CarMapper.java @@ -0,0 +1,20 @@ +package cn.insectmk.bus.mapper; + +import cn.insectmk.bus.domain.Car; +import cn.insectmk.bus.domain.CarVo; + +import java.util.List; + +/** + * @Description 车辆持久层访问接口 + * @Author makun + * @Date 2023/6/29 14:59 + * @Version 1.0 + */ +public interface CarMapper { + int updateByPrimaryKeySelective(Car record); + Car selectByPrimaryKey(String carnumber); + int deleteByPrimaryKey(String carnumber); + int insertSelective(Car record); + List queryAllCar(CarVo carVo); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CheckMapper.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CheckMapper.java new file mode 100644 index 0000000..d98bbfb --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CheckMapper.java @@ -0,0 +1,20 @@ +package cn.insectmk.bus.mapper; + +import cn.insectmk.bus.domain.Check; +import cn.insectmk.bus.domain.CheckVo; + +import java.util.List; + +/** + * @Description 检查单持久层访问接口 + * @Author makun + * @Date 2023/7/4 15:37 + * @Version 1.0 + */ +public interface CheckMapper { + int deleteByPrimaryKey(String checkid); + int updateByPrimaryKeySelective(Check record); + //查询 + List queryAllCheck(Check check); + void insertSelective(CheckVo checkVo); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CustomerMapper.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CustomerMapper.java new file mode 100644 index 0000000..8001b66 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/CustomerMapper.java @@ -0,0 +1,24 @@ +package cn.insectmk.bus.mapper; + +import cn.insectmk.bus.domain.Customer; + +import java.util.List; + +/** + * @Description 客户持久层访问接口 + * @Author makun + * @Date 2023/6/28 16:56 + * @Version 1.0 + */ +public interface CustomerMapper { + Customer selectByPrimaryKey(String identity); + int updateByPrimaryKeySelective(Customer record); + int deleteByPrimaryKey(String identity); + int insertSelective(Customer record); + /** + * 查询 + * @param customer + * @return + */ + List queryAllCustomer(Customer customer); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/RentMapper.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/RentMapper.java new file mode 100644 index 0000000..41d96f9 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/mapper/RentMapper.java @@ -0,0 +1,23 @@ +package cn.insectmk.bus.mapper; + +import cn.insectmk.bus.domain.Rent; + +import java.util.List; + +/** + * @Description 租借表持久层访问 + * @Author makun + * @Date 2023/7/3 21:17 + * @Version 1.0 + */ +public interface RentMapper { + int deleteByPrimaryKey(String rentid); + int updateByPrimaryKeySelective(Rent record); + /** + * @return 查询 + */ + List queryAllRent(Rent rent); + int insertSelective(Rent record); + + Rent selectByPrimaryKey(String rentId); +} \ No newline at end of file diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CarService.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CarService.java new file mode 100644 index 0000000..c08c3af --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CarService.java @@ -0,0 +1,52 @@ +package cn.insectmk.bus.service; + +import cn.insectmk.bus.domain.Car; +import cn.insectmk.bus.domain.CarVo; +import cn.insectmk.sys.domain.DataGridView; + +/** + * @Description 车辆服务接口 + * @Author makun + * @Date 2023/6/29 14:58 + * @Version 1.0 + */ +public interface CarService { + /** + * 批量删除车辆 + * @param carnumbers + */ + public void deleteBatchCar(String[] carnumbers); + + /** + * 根据车牌号查询 + * @param carnumber + * @return + */ + Car queryCarByCarNumber(String carnumber); + + /** + * 修改车辆 + * @param carVo + */ + public void updateCar(CarVo carVo); + + /** + * 根据id删除车辆 + * @param carnumber + */ + public void deleteCar(String carnumber); + + /** + * 查询所有车辆 + * + * @param carVo + * @return + */ + public DataGridView queryAllCar(CarVo carVo); + + /** + * 添加车辆 + * @param carVo + */ + public void addCar(CarVo carVo); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CheckService.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CheckService.java new file mode 100644 index 0000000..4d1f151 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CheckService.java @@ -0,0 +1,50 @@ +package cn.insectmk.bus.service; + +import cn.insectmk.bus.domain.CheckVo; +import cn.insectmk.sys.domain.DataGridView; +import java.util.Map; + +/** + * @Description 入库检查表服务接口 + * @Author makun + * @Date 2023/7/4 15:34 + * @Version 1.0 + */ +public interface CheckService { + /** + * 批量删除检查单 + * @param ids + */ + void deleteBatchCheck(String[] ids); + + /** + * 删除检查单 + * @param checkVo + */ + void deleteCheck(CheckVo checkVo); + + /** + * 更新检查单 + * @param checkVo + */ + void updateCheck(CheckVo checkVo); + + /** + * 保存检查单数据 + * @param checkVo + */ + void addCheck(CheckVo checkVo); + + /** + * 根据出租单号加载检测单的表单数据 + * @param rentid + * @return + */ + Map initCheckFormData(String rentid); + + /** + * 查询所有检查单 + * @return + */ + DataGridView queryAllCheck(CheckVo checkVo); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CustomerService.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CustomerService.java new file mode 100644 index 0000000..2b0ade1 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/CustomerService.java @@ -0,0 +1,51 @@ +package cn.insectmk.bus.service; + +import cn.insectmk.bus.domain.Customer; +import cn.insectmk.bus.domain.CustomerVo; +import cn.insectmk.sys.domain.DataGridView; + +/** + * @Description 客户服务类 + * @Author makun + * @Date 2023/6/28 16:54 + * @Version 1.0 + */ +public interface CustomerService { + /** + * 根据身份号查询客户信息 + * @param identity + * @return + */ + Customer queryCustomerByIdentity(String identity); + + /** + * 批量删除客户 + * @param identitys + */ + public void deleteBatchCustomer(String[] identitys); + + /** + * 修改客户 + * @param customerVo + */ + public void updateCustomer(CustomerVo customerVo); + + /** + * 删除客户 + * @param identity + */ + public void deleteCustomer(String identity); + + /** + * 查询所有客户 + * @param customerVo + * @return + */ + public DataGridView queryAllCustomer(CustomerVo customerVo); + + /** + * 添加客户 + * @param customerVo + */ + public void addCustomer(CustomerVo customerVo); +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/RentService.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/RentService.java new file mode 100644 index 0000000..240119c --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/RentService.java @@ -0,0 +1,42 @@ +package cn.insectmk.bus.service; + +import cn.insectmk.bus.domain.Rent; +import cn.insectmk.bus.domain.RentVo; +import cn.insectmk.sys.domain.DataGridView; + +/** + * @Description 租借服务接口 + * @Author makun + * @Date 2023/7/3 21:16 + * @Version 1.0 + */ +public interface RentService { + + + /** + * 删除出租单 + * @param rentId + */ + void deleteRent(String rentId); + + /** + * 修改出租单 + * @param rentVo + */ + void updateRent(RentVo rentVo); + + /** + * 查询 + * @param rentVo + */ + DataGridView queryAllRent(RentVo rentVo); + + void addRent(RentVo rentVo); + + /** + * 根据出租单号查询出租单信息 + * @param rentid + * @return + */ + Rent queryRentByRentId(String rentid); +} \ No newline at end of file diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CarServiceImpl.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CarServiceImpl.java new file mode 100644 index 0000000..18722ef --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CarServiceImpl.java @@ -0,0 +1,88 @@ +package cn.insectmk.bus.service.impl; + +import cn.insectmk.bus.domain.Car; +import cn.insectmk.bus.domain.CarVo; +import cn.insectmk.bus.mapper.CarMapper; +import cn.insectmk.bus.service.CarService; +import cn.insectmk.sys.domain.DataGridView; +import cn.insectmk.sys.utils.AppFileUtils; +import cn.insectmk.sys.utils.SysConstant; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +/** + * @Description 车辆服务实现类 + * @Author makun + * @Date 2023/6/29 14:58 + * @Version 1.0 + */ +@Service +public class CarServiceImpl implements CarService { + /** + * 批量删除车辆 + * @param carnumbers + */ + @Override + public void deleteBatchCar(String[] carnumbers) { + for (String carnumber : carnumbers) { + this.deleteCar(carnumber); + } + } + + @Override + public Car queryCarByCarNumber(String carnumber) { + return this.carMapper.selectByPrimaryKey(carnumber); + } + + /** + * 更新一个车辆 + * @param carVo + */ + @Override + public void updateCar(CarVo carVo) { + this.carMapper.updateByPrimaryKeySelective(carVo); + } + + /** + * 删除一个车辆 + * @param carnumber + */ + @Override + public void deleteCar(String carnumber) { + //先删除图片 + Car car = this.carMapper.selectByPrimaryKey(carnumber); + //如果不是默认图片就删除 + if (!car.getCarimg().equals(SysConstant.DEFAULT_CAR_IMG)){ + AppFileUtils.deleteFileUsePath(car.getCarimg()); + } + //删除数据库的数据 + this.carMapper.deleteByPrimaryKey(carnumber); + } + /** + * 添加一个车辆 + * @param carVo + */ + @Override + public void addCar(CarVo carVo) { + this.carMapper.insertSelective(carVo); + } + + @Autowired + private CarMapper carMapper; + + /** + * 查询所有信息 + * @param carVo + * @return + */ + @Override + public DataGridView queryAllCar(CarVo carVo) { + Page page = PageHelper.startPage(carVo.getPage(),carVo.getLimit()); + List data = this.carMapper.queryAllCar(carVo); + + return new DataGridView(page.getTotal(),data); + } +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CheckServiceImpl.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CheckServiceImpl.java new file mode 100644 index 0000000..cf01866 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CheckServiceImpl.java @@ -0,0 +1,123 @@ +package cn.insectmk.bus.service.impl; + +import cn.insectmk.bus.domain.*; +import cn.insectmk.bus.mapper.CarMapper; +import cn.insectmk.bus.mapper.CheckMapper; +import cn.insectmk.bus.mapper.CustomerMapper; +import cn.insectmk.bus.mapper.RentMapper; +import cn.insectmk.bus.service.CheckService; +import cn.insectmk.sys.domain.DataGridView; +import cn.insectmk.sys.domain.User; +import cn.insectmk.sys.utils.RandomUtils; +import cn.insectmk.sys.utils.SysConstant; +import cn.insectmk.sys.utils.WebUtils; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description 入库检查服务接口实现类 + * @Author makun + * @Date 2023/7/4 15:34 + * @Version 1.0 + */ +@Service +public class CheckServiceImpl implements CheckService { + @Autowired + private CheckMapper checkMapper; + @Autowired + private CustomerMapper customerMapper; + @Autowired + private RentMapper rentMapper; + @Autowired + private CarMapper carMapper; + + /** + * 批量删除检查单 + * @param ids + */ + @Override + public void deleteBatchCheck(String[] ids) { + for (String id : ids) { + this.checkMapper.deleteByPrimaryKey(id); + } + } + + /** + * 删除检查单 + * @param checkVo + */ + @Override + public void deleteCheck(CheckVo checkVo) { + this.checkMapper.deleteByPrimaryKey(checkVo.getCheckid()); + } + + /** + * 更新检查单 + * @param checkVo + */ + @Override + public void updateCheck(CheckVo checkVo) { + this.checkMapper.updateByPrimaryKeySelective(checkVo); + } + + /** + * 查询所有检查单 + * @param checkVo + * @return + */ + @Override + public DataGridView queryAllCheck(CheckVo checkVo) { + Page page = PageHelper.startPage(checkVo.getPage(), checkVo.getLimit()); + List data = this.checkMapper.queryAllCheck(checkVo); + return new DataGridView(page.getTotal(),data); + } + + /** + * 保存检查单数据 + * @param checkVo + */ + @Override + public void addCheck(CheckVo checkVo) { + this.checkMapper.insertSelective(checkVo); + //更改出租单的状态 + Rent rent = this.rentMapper.selectByPrimaryKey(checkVo.getRentid()); + //更改为已归还 + rent.setRentflag(SysConstant.RENT_BACK_TRUE); + this.rentMapper.updateByPrimaryKeySelective(rent); + //更改汽车的状态 + Car car = this.carMapper.selectByPrimaryKey(rent.getCarnumber()); + //更改汽车状态为未出租 + car.setIsrenting(SysConstant.RENT_CAR_FALSE); + this.carMapper.updateByPrimaryKeySelective(car); + } + + @Override + public Map initCheckFormData(String rentid) { + //查询出租单 + Rent rent = this.rentMapper.selectByPrimaryKey(rentid); + //查询客户 + Customer customer = this.customerMapper.selectByPrimaryKey(rent.getIdentity()); + //查询车辆 + Car car = this.carMapper.selectByPrimaryKey(rent.getCarnumber()); + //组装check + Check check = new Check(); + check.setCheckid(RandomUtils.createRandomStringUseTime(SysConstant.CAR_ORDER_JC)); + check.setRentid(rentid); + check.setCheckdate(new Date()); + User user = (User) WebUtils.getHttpSession().getAttribute("user"); + check.setOpername(user.getRealname()); + Map map = new HashMap<>(); + map.put("rent", rent); + map.put("customer", customer); + map.put("car", car); + map.put("check", check); + + return map; + } +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CustomerServiceImpl.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..16c842e --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/CustomerServiceImpl.java @@ -0,0 +1,87 @@ +package cn.insectmk.bus.service.impl; + +import cn.insectmk.bus.domain.Customer; +import cn.insectmk.bus.domain.CustomerVo; +import cn.insectmk.sys.domain.DataGridView; +import cn.insectmk.bus.mapper.CustomerMapper; +import cn.insectmk.bus.service.CustomerService; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description 客户服务实现类 + * @Author makun + * @Date 2023/6/28 16:55 + * @Version 1.0 + */ +@Service +public class CustomerServiceImpl implements CustomerService { + @Autowired + private CustomerMapper customerMapper; + + /** + * 通过身份证号查询客户 + * @param identity + * @return + */ + @Override + public Customer queryCustomerByIdentity(String identity) { + return this.customerMapper.selectByPrimaryKey(identity); + } + + /** + * 批量删除客户 + * @param identitys + */ + @Override + public void deleteBatchCustomer(String[] identitys) { + for (String identity : identitys) { + this.deleteCustomer(identity); + } + + } + + /** + * 更新一个客户 + * @param customerVo + */ + @Override + public void updateCustomer(CustomerVo customerVo) { + this.customerMapper.updateByPrimaryKeySelective(customerVo); + } + + /** + * 删除一个客户 + * @param identity + */ + @Override + public void deleteCustomer(String identity) { + this.customerMapper.deleteByPrimaryKey(identity); + } + + /** + * 添加一个客户 + * @param customerVo + */ + @Override + public void addCustomer(CustomerVo customerVo) { + this.customerMapper.insertSelective(customerVo); + } + + /** + * 查询所有客户信息 分页 + * @param customerVo + * @return + */ + @Override + public DataGridView queryAllCustomer(CustomerVo customerVo) { + Page page = PageHelper.startPage(customerVo.getPage(),customerVo.getLimit()); + List data = this.customerMapper.queryAllCustomer(customerVo); + + return new DataGridView(page.getTotal(),data); + } +} diff --git a/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/RentServiceImpl.java b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/RentServiceImpl.java new file mode 100644 index 0000000..adf3f80 --- /dev/null +++ b/fengmi-car-management/src/main/java/cn/insectmk/bus/service/impl/RentServiceImpl.java @@ -0,0 +1,71 @@ +package cn.insectmk.bus.service.impl; + +import cn.insectmk.bus.domain.Car; +import cn.insectmk.bus.domain.Rent; +import cn.insectmk.bus.domain.RentVo; +import cn.insectmk.bus.mapper.CarMapper; +import cn.insectmk.bus.mapper.RentMapper; +import cn.insectmk.bus.service.RentService; +import cn.insectmk.sys.domain.DataGridView; +import cn.insectmk.sys.utils.SysConstant; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description 租借服务接口实现 + * @Author makun + * @Date 2023/7/3 21:16 + * @Version 1.0 + */ +@Service +public class RentServiceImpl implements RentService { + @Autowired + private RentMapper rentMapper; + @Autowired + private CarMapper carMapper; + + @Override + public void deleteRent(String rentId) { + //更改汽车状态,将已出租的状态转换成未出租的状态 + Rent rent = rentMapper.selectByPrimaryKey(rentId); + Car car = new Car(); + car.setCarnumber(rent.getCarnumber()); + //转换成未出租的状态 + car.setIsrenting(SysConstant.RENT_CAR_FALSE); + carMapper.updateByPrimaryKeySelective(car); + this.rentMapper.deleteByPrimaryKey(rentId); + } + + @Override + public void updateRent(RentVo rentVo) { + this.rentMapper.updateByPrimaryKeySelective(rentVo); + } + + @Override + public DataGridView queryAllRent(RentVo rentVo) { + Page page = PageHelper.startPage(rentVo.getPage(),rentVo.getLimit()); + List data = this.rentMapper.queryAllRent(rentVo); + return new DataGridView(page.getTotal(),data); + } + + @Override + public void addRent(RentVo rentVo) { + this.rentMapper.insertSelective(rentVo); + //更改车辆出租的状态 + Car car = new Car(); + car.setCarnumber(rentVo.getCarnumber()); + //设置状态为已出租 + car.setIsrenting(SysConstant.RENT_BACK_TRUE); + carMapper.updateByPrimaryKeySelective(car); + } + + @Override + public Rent queryRentByRentId(String rentid) { + return rentMapper.selectByPrimaryKey(rentid); + } + +} -- Gitee