diff --git a/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatCarController.java b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatCarController.java new file mode 100644 index 0000000..e44cb40 --- /dev/null +++ b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatCarController.java @@ -0,0 +1,105 @@ +package com.cpxt.web.controller.biz; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.cpxt.biz.domain.StatCar; +import com.cpxt.biz.service.IStatCarService; +import com.cpxt.common.utils.poi.ExcelUtil; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.cpxt.common.annotation.Log; +import com.cpxt.common.core.controller.BaseController; +import com.cpxt.common.core.domain.AjaxResult; +import com.cpxt.common.enums.BusinessType; +import com.cpxt.common.core.page.TableDataInfo; + +/** + * 车辆统计Controller + * + * @author ruoyi + * @date 2024-12-31 + */ +@RestController +@RequestMapping("/system/car") +public class StatCarController extends BaseController +{ + @Autowired + private IStatCarService statCarService; + + /** + * 查询车辆统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:car:list')") + @GetMapping("/list") + public TableDataInfo list(StatCar statCar) + { + startPage(); + List list = statCarService.selectStatCarList(statCar); + return getDataTable(list); + } + + /** + * 导出车辆统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:car:export')") + @Log(title = "车辆统计", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, StatCar statCar) + { + List list = statCarService.selectStatCarList(statCar); + ExcelUtil util = new ExcelUtil(StatCar.class); + util.exportExcel(response, list, "车辆统计数据"); + } + + /** + * 获取车辆统计详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:car:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(statCarService.selectStatCarById(id)); + } + + /** + * 新增车辆统计 + */ + @PreAuthorize("@ss.hasPermi('system:car:add')") + @Log(title = "车辆统计", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody StatCar statCar) + { + return toAjax(statCarService.insertStatCar(statCar)); + } + + /** + * 修改车辆统计 + */ + @PreAuthorize("@ss.hasPermi('system:car:edit')") + @Log(title = "车辆统计", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody StatCar statCar) + { + return toAjax(statCarService.updateStatCar(statCar)); + } + + /** + * 删除车辆统计 + */ + @PreAuthorize("@ss.hasPermi('system:car:remove')") + @Log(title = "车辆统计", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(statCarService.deleteStatCarByIds(ids)); + } +} diff --git a/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatDriverController.java b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatDriverController.java new file mode 100644 index 0000000..652fe3d --- /dev/null +++ b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/StatDriverController.java @@ -0,0 +1,105 @@ +package com.cpxt.web.controller.biz; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.cpxt.biz.domain.StatDriver; +import com.cpxt.biz.service.IStatDriverService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.cpxt.common.annotation.Log; +import com.cpxt.common.core.controller.BaseController; +import com.cpxt.common.core.domain.AjaxResult; +import com.cpxt.common.enums.BusinessType; +import com.cpxt.common.utils.poi.ExcelUtil; +import com.cpxt.common.core.page.TableDataInfo; + +/** + * 司机统计Controller + * + * @author ruoyi + * @date 2024-12-31 + */ +@RestController +@RequestMapping("/system/driver") +public class StatDriverController extends BaseController +{ + @Autowired + private IStatDriverService statDriverService; + + /** + * 查询司机统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:driver:list')") + @GetMapping("/list") + public TableDataInfo list(StatDriver statDriver) + { + startPage(); + List list = statDriverService.selectStatDriverList(statDriver); + return getDataTable(list); + } + + /** + * 导出司机统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:driver:export')") + @Log(title = "司机统计", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, StatDriver statDriver) + { + List list = statDriverService.selectStatDriverList(statDriver); + ExcelUtil util = new ExcelUtil(StatDriver.class); + util.exportExcel(response, list, "司机统计数据"); + } + + /** + * 获取司机统计详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:driver:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(statDriverService.selectStatDriverById(id)); + } + + /** + * 新增司机统计 + */ + @PreAuthorize("@ss.hasPermi('system:driver:add')") + @Log(title = "司机统计", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody StatDriver statDriver) + { + return toAjax(statDriverService.insertStatDriver(statDriver)); + } + + /** + * 修改司机统计 + */ + @PreAuthorize("@ss.hasPermi('system:driver:edit')") + @Log(title = "司机统计", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody StatDriver statDriver) + { + return toAjax(statDriverService.updateStatDriver(statDriver)); + } + + /** + * 删除司机统计 + */ + @PreAuthorize("@ss.hasPermi('system:driver:remove')") + @Log(title = "司机统计", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(statDriverService.deleteStatDriverByIds(ids)); + } +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/domain/StatCar.java b/cpxt-system/src/main/java/com/cpxt/biz/domain/StatCar.java new file mode 100644 index 0000000..47dc55a --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/domain/StatCar.java @@ -0,0 +1,51 @@ +package com.cpxt.biz.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.cpxt.common.annotation.Excel; +import com.cpxt.common.core.domain.BaseEntity; + +/** + * 车辆统计对象 stat_car + * + * @author ruoyi + * @date 2024-12-31 + */ +@Data +public class StatCar +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** 统计日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "统计日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date statDate; + + /** 车辆ID */ + @Excel(name = "车辆ID") + private Long carId; + + /** 车牌号 */ + @Excel(name = "车牌号") + private String carNo; + + /** 里程数 */ + @Excel(name = "里程数") + private BigDecimal odometer; + + /** 订单数 */ + @Excel(name = "订单数") + private Integer orderCount; + + /** 使用时间 秒 */ + @Excel(name = "使用时间 秒") + private Integer useTime; + +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/domain/StatDriver.java b/cpxt-system/src/main/java/com/cpxt/biz/domain/StatDriver.java new file mode 100644 index 0000000..75ca6a0 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/domain/StatDriver.java @@ -0,0 +1,52 @@ +package com.cpxt.biz.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.cpxt.common.annotation.Excel; +import com.cpxt.common.core.domain.BaseEntity; + +/** + * 司机统计对象 stat_driver + * + * @author ruoyi + * @date 2024-12-31 + */ +@Data +public class StatDriver +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** 统计日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "统计日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date statDate; + + /** 司机ID */ + @Excel(name = "司机ID") + private Long driverId; + + /** 司机名称 */ + @Excel(name = "司机名称") + private String driverName; + + /** 里程数 */ + @Excel(name = "里程数") + private BigDecimal odometer; + + /** 订单数 */ + @Excel(name = "订单数") + private Integer orderCount; + + /** 在线时间 秒 */ + @Excel(name = "在线时间 秒") + private Integer onlineTime; + + +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatCarMapper.java b/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatCarMapper.java new file mode 100644 index 0000000..fd8f34c --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatCarMapper.java @@ -0,0 +1,19 @@ +package com.cpxt.biz.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cpxt.biz.domain.StatCar; +import org.apache.ibatis.annotations.Mapper; + +/** + * 车辆统计Mapper接口 + * + * @author ruoyi + * @date 2024-12-31 + */ +@Mapper +public interface StatCarMapper extends BaseMapper +{ + +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatDriverMapper.java b/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatDriverMapper.java new file mode 100644 index 0000000..33ad330 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/mapper/StatDriverMapper.java @@ -0,0 +1,19 @@ +package com.cpxt.biz.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.cpxt.biz.domain.StatDriver; +import org.apache.ibatis.annotations.Mapper; + +/** + * 司机统计Mapper接口 + * + * @author ruoyi + * @date 2024-12-31 + */ +@Mapper +public interface StatDriverMapper extends BaseMapper +{ + +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/IStatCarService.java b/cpxt-system/src/main/java/com/cpxt/biz/service/IStatCarService.java new file mode 100644 index 0000000..c19d0d3 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/IStatCarService.java @@ -0,0 +1,62 @@ +package com.cpxt.biz.service; + +import com.cpxt.biz.domain.StatCar; + +import java.util.List; + +/** + * 车辆统计Service接口 + * + * @author ruoyi + * @date 2024-12-31 + */ +public interface IStatCarService +{ + /** + * 查询车辆统计 + * + * @param id 车辆统计主键 + * @return 车辆统计 + */ + public StatCar selectStatCarById(Long id); + + /** + * 查询车辆统计列表 + * + * @param statCar 车辆统计 + * @return 车辆统计集合 + */ + public List selectStatCarList(StatCar statCar); + + /** + * 新增车辆统计 + * + * @param statCar 车辆统计 + * @return 结果 + */ + public int insertStatCar(StatCar statCar); + + /** + * 修改车辆统计 + * + * @param statCar 车辆统计 + * @return 结果 + */ + public int updateStatCar(StatCar statCar); + + /** + * 批量删除车辆统计 + * + * @param ids 需要删除的车辆统计主键集合 + * @return 结果 + */ + public int deleteStatCarByIds(Long[] ids); + + /** + * 删除车辆统计信息 + * + * @param id 车辆统计主键 + * @return 结果 + */ + public int deleteStatCarById(Long id); +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/IStatDriverService.java b/cpxt-system/src/main/java/com/cpxt/biz/service/IStatDriverService.java new file mode 100644 index 0000000..cd9eb09 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/IStatDriverService.java @@ -0,0 +1,62 @@ +package com.cpxt.biz.service; + +import com.cpxt.biz.domain.StatDriver; + +import java.util.List; + +/** + * 司机统计Service接口 + * + * @author ruoyi + * @date 2024-12-31 + */ +public interface IStatDriverService +{ + /** + * 查询司机统计 + * + * @param id 司机统计主键 + * @return 司机统计 + */ + public StatDriver selectStatDriverById(Long id); + + /** + * 查询司机统计列表 + * + * @param statDriver 司机统计 + * @return 司机统计集合 + */ + public List selectStatDriverList(StatDriver statDriver); + + /** + * 新增司机统计 + * + * @param statDriver 司机统计 + * @return 结果 + */ + public int insertStatDriver(StatDriver statDriver); + + /** + * 修改司机统计 + * + * @param statDriver 司机统计 + * @return 结果 + */ + public int updateStatDriver(StatDriver statDriver); + + /** + * 批量删除司机统计 + * + * @param ids 需要删除的司机统计主键集合 + * @return 结果 + */ + public int deleteStatDriverByIds(Long[] ids); + + /** + * 删除司机统计信息 + * + * @param id 司机统计主键 + * @return 结果 + */ + public int deleteStatDriverById(Long id); +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatCarServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatCarServiceImpl.java new file mode 100644 index 0000000..31daad0 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatCarServiceImpl.java @@ -0,0 +1,97 @@ +package com.cpxt.biz.service.impl; + +import java.util.Arrays; +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.cpxt.biz.domain.StatCar; +import com.cpxt.biz.mapper.StatCarMapper; +import com.cpxt.biz.service.IStatCarService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 车辆统计Service业务层处理 + * + * @author ruoyi + * @date 2024-12-31 + */ +@Service +public class StatCarServiceImpl implements IStatCarService +{ + @Autowired + private StatCarMapper statCarMapper; + + /** + * 查询车辆统计 + * + * @param id 车辆统计主键 + * @return 车辆统计 + */ + @Override + public StatCar selectStatCarById(Long id) + { + return statCarMapper.selectById(id); + } + + /** + * 查询车辆统计列表 + * + * @param statCar 车辆统计 + * @return 车辆统计 + */ + @Override + public List selectStatCarList(StatCar statCar) + { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + return statCarMapper.selectList(queryWrapper); + } + + /** + * 新增车辆统计 + * + * @param statCar 车辆统计 + * @return 结果 + */ + @Override + public int insertStatCar(StatCar statCar) + { + return statCarMapper.insert(statCar); + } + + /** + * 修改车辆统计 + * + * @param statCar 车辆统计 + * @return 结果 + */ + @Override + public int updateStatCar(StatCar statCar) + { + return statCarMapper.updateById(statCar); + } + + /** + * 批量删除车辆统计 + * + * @param ids 需要删除的车辆统计主键 + * @return 结果 + */ + @Override + public int deleteStatCarByIds(Long[] ids) + { + return statCarMapper.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 删除车辆统计信息 + * + * @param id 车辆统计主键 + * @return 结果 + */ + @Override + public int deleteStatCarById(Long id) + { + return statCarMapper.deleteById(id); + } +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatDriverServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatDriverServiceImpl.java new file mode 100644 index 0000000..d6d79d6 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/StatDriverServiceImpl.java @@ -0,0 +1,97 @@ +package com.cpxt.biz.service.impl; + +import java.util.Arrays; +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.cpxt.biz.domain.StatDriver; +import com.cpxt.biz.mapper.StatDriverMapper; +import com.cpxt.biz.service.IStatDriverService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 司机统计Service业务层处理 + * + * @author ruoyi + * @date 2024-12-31 + */ +@Service +public class StatDriverServiceImpl implements IStatDriverService +{ + @Autowired + private StatDriverMapper statDriverMapper; + + /** + * 查询司机统计 + * + * @param id 司机统计主键 + * @return 司机统计 + */ + @Override + public StatDriver selectStatDriverById(Long id) + { + return statDriverMapper.selectById(id); + } + + /** + * 查询司机统计列表 + * + * @param statDriver 司机统计 + * @return 司机统计 + */ + @Override + public List selectStatDriverList(StatDriver statDriver) + { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + return statDriverMapper.selectList(queryWrapper); + } + + /** + * 新增司机统计 + * + * @param statDriver 司机统计 + * @return 结果 + */ + @Override + public int insertStatDriver(StatDriver statDriver) + { + return statDriverMapper.insert(statDriver); + } + + /** + * 修改司机统计 + * + * @param statDriver 司机统计 + * @return 结果 + */ + @Override + public int updateStatDriver(StatDriver statDriver) + { + return statDriverMapper.updateById(statDriver); + } + + /** + * 批量删除司机统计 + * + * @param ids 需要删除的司机统计主键 + * @return 结果 + */ + @Override + public int deleteStatDriverByIds(Long[] ids) + { + return statDriverMapper.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 删除司机统计信息 + * + * @param id 司机统计主键 + * @return 结果 + */ + @Override + public int deleteStatDriverById(Long id) + { + return statDriverMapper.deleteById(id); + } +}