车辆、司机统计模块

master
luojian 2024-12-31 17:50:46 +08:00
parent 3f1ad3e7d2
commit 54c939bb30
10 changed files with 669 additions and 0 deletions

View File

@ -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<StatCar> 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<StatCar> list = statCarService.selectStatCarList(statCar);
ExcelUtil<StatCar> util = new ExcelUtil<StatCar>(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));
}
}

View File

@ -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<StatDriver> 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<StatDriver> list = statDriverService.selectStatDriverList(statDriver);
ExcelUtil<StatDriver> util = new ExcelUtil<StatDriver>(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));
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<StatCar>
{
}

View File

@ -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<StatDriver>
{
}

View File

@ -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<StatCar> 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);
}

View File

@ -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<StatDriver> 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);
}

View File

@ -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<StatCar> selectStatCarList(StatCar statCar)
{
LambdaQueryWrapper<StatCar> 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);
}
}

View File

@ -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<StatDriver> selectStatDriverList(StatDriver statDriver)
{
LambdaQueryWrapper<StatDriver> 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);
}
}