From b3671a6d77195ccf99e0630a22c3b3dccd265ebe Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Thu, 16 Mar 2023 16:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-druid.yml | 4 + .../controller/BaseCarController.java | 44 ++- .../BaseCarGpsRecordController.java | 104 ++++++ .../controller/BaseCarQueueController.java | 23 +- .../controller/BaseCarTypeController.java | 24 +- .../controller/BaseDeviceController.java | 24 +- .../controller/BaseTyreController.java | 90 ++++- .../BaseTyreHistoricalRecordsController.java | 104 ++++++ .../CollectMachineGpsController.java | 24 +- .../com/ruoyi/basetyre/domain/BaseCar.java | 34 +- .../basetyre/domain/BaseCarGpsRecord.java | 184 ++++++++++ .../com/ruoyi/basetyre/domain/BaseTyre.java | 48 +-- .../domain/BaseTyreHistoricalRecords.java | 138 ++++++++ .../ruoyi/basetyre/domain/vo/CarTyres.java | 34 ++ .../ruoyi/basetyre/domain/vo/TyresLife.java | 13 + .../mapper/BaseCarGpsRecordMapper.java | 61 ++++ .../ruoyi/basetyre/mapper/BaseCarMapper.java | 5 + .../BaseTyreHistoricalRecordsMapper.java | 61 ++++ .../ruoyi/basetyre/mapper/BaseTyreMapper.java | 18 +- .../redislistener/RedisMessageListener.java | 37 ++- .../service/IBaseCarGpsRecordService.java | 61 ++++ .../basetyre/service/IBaseCarService.java | 5 + .../IBaseTyreHistoricalRecordsService.java | 61 ++++ .../basetyre/service/IBaseTyreService.java | 18 +- .../impl/BaseCarGpsRecordServiceImpl.java | 95 ++++++ .../service/impl/BaseCarServiceImpl.java | 11 + .../BaseTyreHistoricalRecordsServiceImpl.java | 96 ++++++ .../service/impl/BaseTyreServiceImpl.java | 244 +++++++++++++- .../basetyre/BaseCarGpsRecordMapper.xml | 107 ++++++ .../mapper/basetyre/BaseCarMapper.xml | 60 +++- .../BaseTyreHistoricalRecordsMapper.xml | 92 +++++ .../mapper/basetyre/BaseTyreMapper.xml | 101 +++++- ruoyi-common/pom.xml | 7 + ruoyi-ui/.env.production | 2 +- ruoyi-ui/src/api/basetyre/basetyre.js | 8 +- .../src/views/report/temppresspeed/index.vue | 313 ++++++++++++++++++ .../src/views/tireManagement/info/index.vue | 31 +- ruoyi-ui/vite.config.js | 4 +- 38 files changed, 2216 insertions(+), 174 deletions(-) create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarGpsRecordController.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreHistoricalRecordsController.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCarGpsRecord.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyreHistoricalRecords.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/CarTyres.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/TyresLife.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarGpsRecordMapper.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreHistoricalRecordsMapper.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarGpsRecordService.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreHistoricalRecordsService.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarGpsRecordServiceImpl.java create mode 100644 ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java create mode 100644 ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarGpsRecordMapper.xml create mode 100644 ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreHistoricalRecordsMapper.xml create mode 100644 ruoyi-ui/src/views/report/temppresspeed/index.vue diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index c44d91b..fd778fd 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,6 +6,9 @@ spring: druid: # 主库数据源 master: +# url: jdbc:sqlserver://172.30.12.8:1433;SelectMethod=cursor;DatabaseName=XY_SMART_TIRE +# username: tscpdb +# password: MSSQL@bs.c321 url: jdbc:sqlserver://172.16.251.187:1433;SelectMethod=cursor;DatabaseName=XY_SMART_TIRE username: DNC password: dnc @@ -14,6 +17,7 @@ spring: # 从数据源开关/默认关闭 enabled: false url: + username: password: # 初始连接数 diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarController.java index 70a1252..84510db 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarController.java @@ -1,33 +1,29 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; - +import com.ruoyi.basetyre.domain.BaseCar; import com.ruoyi.basetyre.domain.BaseCarQueue; import com.ruoyi.basetyre.domain.BaseCarType; import com.ruoyi.basetyre.domain.BaseDevice; +import com.ruoyi.basetyre.domain.vo.CarTyres; import com.ruoyi.basetyre.service.IBaseCarQueueService; +import com.ruoyi.basetyre.service.IBaseCarService; import com.ruoyi.basetyre.service.IBaseCarTypeService; import com.ruoyi.basetyre.service.IBaseDeviceService; -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.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.domain.BaseCar; -import com.ruoyi.basetyre.service.IBaseCarService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 车辆基础信息Controller @@ -123,7 +119,7 @@ public class BaseCarController extends BaseController @GetMapping("/getCarQueueAndType") public AjaxResult getCarQueue_Type(){ BaseCarQueue baseCarQueue=new BaseCarQueue(); - BaseCarType baseCarType = new BaseCarType(); + BaseCarType baseCarType = new BaseCarType(); baseCarQueue.setState((long) 0); baseCarQueue.setState((long) 0); List baseCarQueueList = baseCarQueueService.selectBaseCarQueueList(baseCarQueue); @@ -155,4 +151,16 @@ public class BaseCarController extends BaseController return success(baseCarList); } + @GetMapping("/carTyres") + public AjaxResult carTyres(BaseCar baseCar){ + //查询车辆车型 + List list = baseCarService.queryList(baseCar); + baseCar=list.get(0); + Map map=new HashMap(); + map.put("carType",baseCar.getCarTypeId()); + List carTyresList = baseCarService.selectCarTyres(baseCar); + map.put("carTyresList",carTyresList); + return success(map); + } + } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarGpsRecordController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarGpsRecordController.java new file mode 100644 index 0000000..986b1dd --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarGpsRecordController.java @@ -0,0 +1,104 @@ +package com.ruoyi.basetyre.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.basetyre.domain.BaseCarGpsRecord; +import com.ruoyi.basetyre.service.IBaseCarGpsRecordService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 车辆GPS记录Controller + * + * @author Yangwl + * @date 2023-03-14 + */ +@RestController +@RequestMapping("/basetyre/BaseCarGpsRecord") +public class BaseCarGpsRecordController extends BaseController +{ + @Autowired + private IBaseCarGpsRecordService baseCarGpsRecordService; + + /** + * 查询车辆GPS记录列表 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:list')") + @GetMapping("/list") + public TableDataInfo list(BaseCarGpsRecord baseCarGpsRecord) + { + startPage(); + List list = baseCarGpsRecordService.selectBaseCarGpsRecordList(baseCarGpsRecord); + return getDataTable(list); + } + + /** + * 导出车辆GPS记录列表 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:export')") + @Log(title = "车辆GPS记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseCarGpsRecord baseCarGpsRecord) + { + List list = baseCarGpsRecordService.selectBaseCarGpsRecordList(baseCarGpsRecord); + ExcelUtil util = new ExcelUtil(BaseCarGpsRecord.class); + util.exportExcel(response, list, "车辆GPS记录数据"); + } + + /** + * 获取车辆GPS记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(baseCarGpsRecordService.selectBaseCarGpsRecordById(id)); + } + + /** + * 新增车辆GPS记录 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:add')") + @Log(title = "车辆GPS记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseCarGpsRecord baseCarGpsRecord) + { + return toAjax(baseCarGpsRecordService.insertBaseCarGpsRecord(baseCarGpsRecord)); + } + + /** + * 修改车辆GPS记录 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:edit')") + @Log(title = "车辆GPS记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseCarGpsRecord baseCarGpsRecord) + { + return toAjax(baseCarGpsRecordService.updateBaseCarGpsRecord(baseCarGpsRecord)); + } + + /** + * 删除车辆GPS记录 + */ + @PreAuthorize("@ss.hasPermi('basetyre:BaseCarGpsRecord:remove')") + @Log(title = "车辆GPS记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(baseCarGpsRecordService.deleteBaseCarGpsRecordByIds(ids)); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarQueueController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarQueueController.java index 79be465..7e0de4f 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarQueueController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarQueueController.java @@ -1,26 +1,19 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; - import com.ruoyi.basetyre.domain.BaseCarQueue; -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.ruoyi.basetyre.service.IBaseCarQueueService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.service.IBaseCarQueueService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 车队信息管理Controller diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarTypeController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarTypeController.java index 9812886..b7ac3d4 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarTypeController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseCarTypeController.java @@ -1,25 +1,19 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; -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.ruoyi.basetyre.domain.BaseCarType; +import com.ruoyi.basetyre.service.IBaseCarTypeService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.domain.BaseCarType; -import com.ruoyi.basetyre.service.IBaseCarTypeService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 车辆类型Controller diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseDeviceController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseDeviceController.java index b57b4a2..d96c534 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseDeviceController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseDeviceController.java @@ -1,25 +1,19 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; -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.ruoyi.basetyre.domain.BaseDevice; +import com.ruoyi.basetyre.service.IBaseDeviceService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.domain.BaseDevice; -import com.ruoyi.basetyre.service.IBaseDeviceService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 设备管理Controller diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreController.java index 2a18f66..208d7a2 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreController.java @@ -1,27 +1,22 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; - -import com.ruoyi.common.utils.uuid.UUID; -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.ruoyi.basetyre.domain.BaseTyre; +import com.ruoyi.basetyre.domain.vo.CarTyres; +import com.ruoyi.basetyre.service.IBaseTyreService; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.domain.BaseTyre; -import com.ruoyi.basetyre.service.IBaseTyreService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; /** * 轮胎基础Controller @@ -70,6 +65,25 @@ public class BaseTyreController extends BaseController { return success(baseTyreService.selectBaseTyreById(id)); } + /** + * 获取轮胎基础详细信息 + */ + @GetMapping("/getTyreInfoById") + public AjaxResult getTyreInfoById(@RequestParam("outerTireNumber") String outerTireNumber) + { + BaseTyre baseTyre= baseTyreService.getTyreInfoById(outerTireNumber); + return success(baseTyre); + } + + @GetMapping("/getTyreLife") + public AjaxResult getTyreLife(@RequestParam("outerTireNumber") String outerTireNumber) + { +// Map + + + return baseTyreService.getTyreLife(outerTireNumber); + } + /** * 新增轮胎基础 @@ -79,6 +93,10 @@ public class BaseTyreController extends BaseController @PostMapping public AjaxResult add(@RequestBody BaseTyre baseTyre) { + if (UserConstants.NOT_UNIQUE.equals(baseTyreService.checkBaseTyreUnique(baseTyre))) + { + return error("新增轮胎'" + baseTyre.getOuterTireNumber() + "'失败,外胎号已存在"); + } return toAjax(baseTyreService.insertBaseTyre(baseTyre)); } @@ -90,6 +108,10 @@ public class BaseTyreController extends BaseController @PutMapping public AjaxResult edit(@RequestBody BaseTyre baseTyre) { + if (UserConstants.NOT_UNIQUE.equals(baseTyreService.checkBaseTyreUnique(baseTyre))) + { + return error("修改轮胎'" + baseTyre.getOuterTireNumber() + "'失败,外胎号已存在"); + } return toAjax(baseTyreService.updateBaseTyre(baseTyre)); } @@ -104,5 +126,39 @@ public class BaseTyreController extends BaseController return toAjax(baseTyreService.deleteBaseTyreByIds(ids)); } + /** + * 批量插入轮胎信息 + * @param baseTyre + * @return + */ + @PostMapping("/insertBaseTyres") + public AjaxResult insertBaseTyreList(@RequestBody BaseTyre baseTyre) + { + return baseTyreService.insertBaseTyreList(baseTyre); + } + + /** + * 轮胎安装 + * @param carTyres + * @return + */ + + @PostMapping("/TyreInstall") + public AjaxResult TyreInstall(@RequestBody CarTyres carTyres){ + return baseTyreService.tyreInstall(carTyres); + } + + /** + * 轮胎卸胎 + * @param carTyres + * @return + */ + + @PostMapping("/TyreUnInstall") + public AjaxResult TyreUnInstall(@RequestBody CarTyres carTyres){ + return baseTyreService.TyreUnInstall(carTyres); + } + + } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreHistoricalRecordsController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreHistoricalRecordsController.java new file mode 100644 index 0000000..aa42cff --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/BaseTyreHistoricalRecordsController.java @@ -0,0 +1,104 @@ +package com.ruoyi.basetyre.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords; +import com.ruoyi.basetyre.service.IBaseTyreHistoricalRecordsService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 轮胎历史Controller + * + * @author Yangwl + * @date 2023-03-13 + */ +@RestController +@RequestMapping("/basetyre/tyre_historical_records") +public class BaseTyreHistoricalRecordsController extends BaseController +{ + @Autowired + private IBaseTyreHistoricalRecordsService baseTyreHistoricalRecordsService; + + /** + * 查询轮胎历史列表 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:list')") + @GetMapping("/list") + public TableDataInfo list(BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + startPage(); + List list = baseTyreHistoricalRecordsService.selectBaseTyreHistoricalRecordsList(baseTyreHistoricalRecords); + return getDataTable(list); + } + + /** + * 导出轮胎历史列表 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:export')") + @Log(title = "轮胎历史", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + List list = baseTyreHistoricalRecordsService.selectBaseTyreHistoricalRecordsList(baseTyreHistoricalRecords); + ExcelUtil util = new ExcelUtil(BaseTyreHistoricalRecords.class); + util.exportExcel(response, list, "轮胎历史数据"); + } + + /** + * 获取轮胎历史详细信息 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(baseTyreHistoricalRecordsService.selectBaseTyreHistoricalRecordsById(id)); + } + + /** + * 新增轮胎历史 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:add')") + @Log(title = "轮胎历史", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + return toAjax(baseTyreHistoricalRecordsService.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords)); + } + + /** + * 修改轮胎历史 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:edit')") + @Log(title = "轮胎历史", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + return toAjax(baseTyreHistoricalRecordsService.updateBaseTyreHistoricalRecords(baseTyreHistoricalRecords)); + } + + /** + * 删除轮胎历史 + */ + @PreAuthorize("@ss.hasPermi('basetyre:tyre_historical_records:remove')") + @Log(title = "轮胎历史", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(baseTyreHistoricalRecordsService.deleteBaseTyreHistoricalRecordsByIds(ids)); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/CollectMachineGpsController.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/CollectMachineGpsController.java index 0522af7..9a8c43b 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/CollectMachineGpsController.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/controller/CollectMachineGpsController.java @@ -1,25 +1,19 @@ package com.ruoyi.basetyre.controller; -import java.util.List; -import javax.servlet.http.HttpServletResponse; -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.ruoyi.basetyre.domain.CollectMachineGps; +import com.ruoyi.basetyre.service.ICollectMachineGpsService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.basetyre.domain.CollectMachineGps; -import com.ruoyi.basetyre.service.ICollectMachineGpsService; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * GPS记录Controller diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCar.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCar.java index 58527e8..2a15c99 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCar.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCar.java @@ -2,6 +2,8 @@ package com.ruoyi.basetyre.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -35,6 +37,8 @@ public class BaseCar extends BaseEntity @Excel(name = "车型ID") private String carTypeId; + private String cartype; + /** 车牌号 */ @Excel(name = "车牌号") @NotBlank(message = "车牌号为空") @@ -88,11 +92,11 @@ public class BaseCar extends BaseEntity /** 最新GPS经度 */ @Excel(name = "最新GPS经度") - private BigDecimal longitude; + private double longitude; /** 最新GPS纬度 */ @Excel(name = "最新GPS纬度") - private BigDecimal latitude; + private double latitude; /** 轮胎数 */ @Excel(name = "轮胎数") @@ -130,6 +134,24 @@ public class BaseCar extends BaseEntity //车队id private String queueId; + private List TyreList; + + public String getCartype() { + return cartype; + } + + public void setCartype(String cartype) { + this.cartype = cartype; + } + + public List getTyreList() { + return TyreList; + } + + public void setTyreList(List tyreList) { + TyreList = tyreList; + } + public String getQueueId() { return queueId; } @@ -298,21 +320,21 @@ public class BaseCar extends BaseEntity { return isHasDevice; } - public void setLongitude(BigDecimal longitude) + public void setLongitude(double longitude) { this.longitude = longitude; } - public BigDecimal getLongitude() + public double getLongitude() { return longitude; } - public void setLatitude(BigDecimal latitude) + public void setLatitude(double latitude) { this.latitude = latitude; } - public BigDecimal getLatitude() + public double getLatitude() { return latitude; } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCarGpsRecord.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCarGpsRecord.java new file mode 100644 index 0000000..591ff4e --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseCarGpsRecord.java @@ -0,0 +1,184 @@ +package com.ruoyi.basetyre.domain; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 车辆GPS记录对象 base_car_gps_record + * + * @author Yangwl + * @date 2023-03-14 + */ +public class BaseCarGpsRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private String id; + + /** 轮胎厂编号 */ + @Excel(name = "轮胎厂编号") + private String tyreFacCode; + + /** 企业编号 */ + @Excel(name = "企业编号") + private String companyCode; + + /** 车辆ID */ + @Excel(name = "车辆ID") + private String carId; + + /** 设备ID */ + @Excel(name = "设备ID") + private String deviceId; + + /** 报警状态 */ + @Excel(name = "报警状态") + private Long fireState; + + /** 经度 */ + @Excel(name = "经度") + private double longitude; + + /** 纬度 */ + @Excel(name = "纬度") + private double latitude; + + /** gps日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "gps日期", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDate gpsDate; + + /** gps时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "gps时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalTime gpsTime; + + /** 车上里程表读数 */ + @Excel(name = "车上里程表读数") + private Long carOnlineMileage; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setTyreFacCode(String tyreFacCode) + { + this.tyreFacCode = tyreFacCode; + } + + public String getTyreFacCode() + { + return tyreFacCode; + } + public void setCompanyCode(String companyCode) + { + this.companyCode = companyCode; + } + + public String getCompanyCode() + { + return companyCode; + } + public void setCarId(String carId) + { + this.carId = carId; + } + + public String getCarId() + { + return carId; + } + public void setDeviceId(String deviceId) + { + this.deviceId = deviceId; + } + + public String getDeviceId() + { + return deviceId; + } + public void setFireState(Long fireState) + { + this.fireState = fireState; + } + + public Long getFireState() + { + return fireState; + } + public void setLongitude(double longitude) + { + this.longitude = longitude; + } + + public double getLongitude() + { + return longitude; + } + public void setLatitude(double latitude) + { + this.latitude = latitude; + } + + public double getLatitude() + { + return latitude; + } + public void setGpsDate(LocalDate gpsDate) + { + this.gpsDate = gpsDate; + } + + public LocalDate getGpsDate() + { + return gpsDate; + } + public void setGpsTime(LocalTime gpsTime) + { + this.gpsTime = gpsTime; + } + + public LocalTime getGpsTime() + { + return gpsTime; + } + public void setCarOnlineMileage(Long carOnlineMileage) + { + this.carOnlineMileage = carOnlineMileage; + } + + public Long getCarOnlineMileage() + { + return carOnlineMileage; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tyreFacCode", getTyreFacCode()) + .append("companyCode", getCompanyCode()) + .append("carId", getCarId()) + .append("deviceId", getDeviceId()) + .append("fireState", getFireState()) + .append("longitude", getLongitude()) + .append("latitude", getLatitude()) + .append("gpsDate", getGpsDate()) + .append("gpsTime", getGpsTime()) + .append("carOnlineMileage", getCarOnlineMileage()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyre.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyre.java index b4eac31..5049c6d 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyre.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyre.java @@ -87,27 +87,27 @@ public class BaseTyre extends BaseEntity /** 负荷指数 */ @Excel(name = "负荷指数") - private Long loadIndex; + private String loadIndex; /** 轮辋尺寸 */ @Excel(name = "轮辋尺寸") - private Long rimSize; + private String rimSize; /** 标准重量 */ @Excel(name = "标准重量") - private Long weight; + private String weight; /** 断面宽 */ @Excel(name = "断面宽") - private Long sectionWidth; + private String sectionWidth; /** 外直径 */ @Excel(name = "外直径") - private Long outerDiameter; + private String outerDiameter; /** 扁平率 */ @Excel(name = "扁平率") - private Long flattening; + private String flattening; /** 加强型 */ @Excel(name = "加强型") @@ -119,11 +119,11 @@ public class BaseTyre extends BaseEntity /** 标准花纹深度 */ @Excel(name = "标准花纹深度") - private Long patternDepth; + private String patternDepth; /** 装箱量 */ @Excel(name = "装箱量") - private Long ctn; + private String ctn; /** 轮胎类型 */ @Excel(name = "轮胎类型") @@ -355,57 +355,57 @@ public class BaseTyre extends BaseEntity { return speedLevel; } - public void setLoadIndex(Long loadIndex) + public void setLoadIndex(String loadIndex) { this.loadIndex = loadIndex; } - public Long getLoadIndex() + public String getLoadIndex() { return loadIndex; } - public void setRimSize(Long rimSize) + public void setRimSize(String rimSize) { this.rimSize = rimSize; } - public Long getRimSize() + public String getRimSize() { return rimSize; } - public void setWeight(Long weight) + public void setWeight(String weight) { this.weight = weight; } - public Long getWeight() + public String getWeight() { return weight; } - public void setSectionWidth(Long sectionWidth) + public void setSectionWidth(String sectionWidth) { this.sectionWidth = sectionWidth; } - public Long getSectionWidth() + public String getSectionWidth() { return sectionWidth; } - public void setOuterDiameter(Long outerDiameter) + public void setOuterDiameter(String outerDiameter) { this.outerDiameter = outerDiameter; } - public Long getOuterDiameter() + public String getOuterDiameter() { return outerDiameter; } - public void setFlattening(Long flattening) + public void setFlattening(String flattening) { this.flattening = flattening; } - public Long getFlattening() + public String getFlattening() { return flattening; } @@ -427,21 +427,21 @@ public class BaseTyre extends BaseEntity { return innerTube; } - public void setPatternDepth(Long patternDepth) + public void setPatternDepth(String patternDepth) { this.patternDepth = patternDepth; } - public Long getPatternDepth() + public String getPatternDepth() { return patternDepth; } - public void setCtn(Long ctn) + public void setCtn(String ctn) { this.ctn = ctn; } - public Long getCtn() + public String getCtn() { return ctn; } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyreHistoricalRecords.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyreHistoricalRecords.java new file mode 100644 index 0000000..89931bc --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/BaseTyreHistoricalRecords.java @@ -0,0 +1,138 @@ +package com.ruoyi.basetyre.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import java.math.BigDecimal; + +/** + * 轮胎历史对象 base_tyre_historical_records + * + * @author Yangwl + * @date 2023-03-13 + */ +public class BaseTyreHistoricalRecords extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private String id; + + /** 轮胎ID */ + @Excel(name = "轮胎ID") + private String tyreId; + + /** 轮胎位置 */ + @Excel(name = "轮胎位置") + private String tyrePosition; + + /** 轮胎位置(数字型) */ + @Excel(name = "轮胎位置(数字型)") + private Long tyrePositionNum; + + /** 车辆ID */ + @Excel(name = "车辆ID") + private String carId; + + /** 车牌号 */ + @Excel(name = "车牌号") + private String carLicense; + + /** 操作类型 1,上胎 2,换胎 3,卸胎 4,花纹变更 */ + @Excel(name = "操作类型 1,上胎 2,换胎 3,卸胎 4,花纹变更") + private Long type; + + /** 花纹深度 */ + @Excel(name = "花纹深度") + private BigDecimal textureDepth; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + public void setTyreId(String tyreId) + { + this.tyreId = tyreId; + } + + public String getTyreId() + { + return tyreId; + } + public void setTyrePosition(String tyrePosition) + { + this.tyrePosition = tyrePosition; + } + + public String getTyrePosition() + { + return tyrePosition; + } + public void setTyrePositionNum(Long tyrePositionNum) + { + this.tyrePositionNum = tyrePositionNum; + } + + public Long getTyrePositionNum() + { + return tyrePositionNum; + } + public void setCarId(String carId) + { + this.carId = carId; + } + + public String getCarId() + { + return carId; + } + public void setCarLicense(String carLicense) + { + this.carLicense = carLicense; + } + + public String getCarLicense() + { + return carLicense; + } + public void setType(Long type) + { + this.type = type; + } + + public Long getType() + { + return type; + } + public void setTextureDepth(BigDecimal textureDepth) + { + this.textureDepth = textureDepth; + } + + public BigDecimal getTextureDepth() + { + return textureDepth; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tyreId", getTyreId()) + .append("tyrePosition", getTyrePosition()) + .append("tyrePositionNum", getTyrePositionNum()) + .append("carId", getCarId()) + .append("carLicense", getCarLicense()) + .append("type", getType()) + .append("textureDepth", getTextureDepth()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/CarTyres.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/CarTyres.java new file mode 100644 index 0000000..eed482c --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/CarTyres.java @@ -0,0 +1,34 @@ +package com.ruoyi.basetyre.domain.vo; + + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class CarTyres { + + //车辆id + private String carId; + //车牌号 + private String carLicense; + //轮胎id + private String tyreId; + //轮胎 + private String outerTireNumber; + //所安装轮位 + private String tyrePosition; + //品牌 + private String brand; + //规格 + private String size; + //当前传感器 + private String sensorId; + //当前花纹深度 + private BigDecimal currentTextureDepth; + //操作类型 1,上胎 2,换胎 3,卸胎 4,花纹变更 + private String type; + + + +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/TyresLife.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/TyresLife.java new file mode 100644 index 0000000..5a6ce7e --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/domain/vo/TyresLife.java @@ -0,0 +1,13 @@ +package com.ruoyi.basetyre.domain.vo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class TyresLife { + private Date datetime; + private String description; + private String carLicence; + private String carPosition; +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarGpsRecordMapper.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarGpsRecordMapper.java new file mode 100644 index 0000000..a0a51e4 --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarGpsRecordMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.basetyre.mapper; + +import java.util.List; +import com.ruoyi.basetyre.domain.BaseCarGpsRecord; + +/** + * 车辆GPS记录Mapper接口 + * + * @author Yangwl + * @date 2023-03-14 + */ +public interface BaseCarGpsRecordMapper +{ + /** + * 查询车辆GPS记录 + * + * @param id 车辆GPS记录主键 + * @return 车辆GPS记录 + */ + public BaseCarGpsRecord selectBaseCarGpsRecordById(String id); + + /** + * 查询车辆GPS记录列表 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 车辆GPS记录集合 + */ + public List selectBaseCarGpsRecordList(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 新增车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + public int insertBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 修改车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + public int updateBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 删除车辆GPS记录 + * + * @param id 车辆GPS记录主键 + * @return 结果 + */ + public int deleteBaseCarGpsRecordById(String id); + + /** + * 批量删除车辆GPS记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseCarGpsRecordByIds(String[] ids); +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarMapper.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarMapper.java index 507be32..cd83cb6 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarMapper.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseCarMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.basetyre.mapper; import java.util.List; import com.ruoyi.basetyre.domain.BaseCar; +import com.ruoyi.basetyre.domain.vo.CarTyres; /** * 车辆基础信息Mapper接口 @@ -62,4 +63,8 @@ public interface BaseCarMapper List queryList(BaseCar baseCar); List selectGpsCarList(BaseCar baseCar); + + int updateCarGPS(BaseCar baseCar); + + List selectCarTyres(BaseCar baseCar); } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreHistoricalRecordsMapper.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreHistoricalRecordsMapper.java new file mode 100644 index 0000000..64c354c --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreHistoricalRecordsMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.basetyre.mapper; + +import java.util.List; +import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords; + +/** + * 轮胎历史Mapper接口 + * + * @author Yangwl + * @date 2023-03-13 + */ +public interface BaseTyreHistoricalRecordsMapper +{ + /** + * 查询轮胎历史 + * + * @param id 轮胎历史主键 + * @return 轮胎历史 + */ + public BaseTyreHistoricalRecords selectBaseTyreHistoricalRecordsById(String id); + + /** + * 查询轮胎历史列表 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 轮胎历史集合 + */ + public List selectBaseTyreHistoricalRecordsList(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 新增轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + public int insertBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 修改轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + public int updateBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 删除轮胎历史 + * + * @param id 轮胎历史主键 + * @return 结果 + */ + public int deleteBaseTyreHistoricalRecordsById(String id); + + /** + * 批量删除轮胎历史 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseTyreHistoricalRecordsByIds(String[] ids); +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreMapper.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreMapper.java index 4e5787f..8cb5d75 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreMapper.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/mapper/BaseTyreMapper.java @@ -1,7 +1,12 @@ package com.ruoyi.basetyre.mapper; import java.util.List; +import java.util.Map; + + import com.ruoyi.basetyre.domain.BaseTyre; +import com.ruoyi.basetyre.domain.vo.CarTyres; +import com.ruoyi.common.core.domain.AjaxResult; /** * 轮胎基础Mapper接口 @@ -9,7 +14,7 @@ import com.ruoyi.basetyre.domain.BaseTyre; * @author Yangwl * @date 2023-02-27 */ -public interface BaseTyreMapper +public interface BaseTyreMapper { /** * 查询轮胎基础 @@ -58,4 +63,15 @@ public interface BaseTyreMapper * @return 结果 */ public int deleteBaseTyreByIds(String[] ids); + + boolean insertBaseTyreList(List baseTyresVOSList); + + BaseTyre getTyreInfoById(String outerTireNumber); + + + void UnInstallTyre(BaseTyre baseTyre); + + List> getTyreLife(String outerTireNumber); + + BaseTyre checkBaseTyreUnique(String outerTireNumber); } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/redislistener/RedisMessageListener.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/redislistener/RedisMessageListener.java index 3bd708d..0d5ac87 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/redislistener/RedisMessageListener.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/redislistener/RedisMessageListener.java @@ -1,7 +1,11 @@ package com.ruoyi.basetyre.redislistener; import com.alibaba.fastjson2.JSON; +import com.ruoyi.basetyre.domain.BaseCar; +import com.ruoyi.basetyre.domain.BaseCarGpsRecord; import com.ruoyi.basetyre.domain.CollectMachineGps; +import com.ruoyi.basetyre.service.IBaseCarGpsRecordService; +import com.ruoyi.basetyre.service.IBaseCarService; import com.ruoyi.basetyre.service.ICollectMachineGpsService; import com.ruoyi.common.t808.model.T0200; import com.ruoyi.common.t808.model.T0704; @@ -13,8 +17,14 @@ import org.springframework.data.redis.connection.MessageListener; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; -import java.math.BigDecimal; -import java.text.DecimalFormat; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; import java.util.List; @Component @@ -24,6 +34,10 @@ public class RedisMessageListener implements MessageListener { private RedisTemplate redisTemplate; @Autowired private ICollectMachineGpsService iCollectMachineGpsService; + @Autowired + private IBaseCarService iBaseCarService; + @Autowired + private IBaseCarGpsRecordService iBaseCarGpsRecordService; @Override public void onMessage(Message message, byte[] pattern) { @@ -37,6 +51,7 @@ public class RedisMessageListener implements MessageListener { Object channel = redisTemplate.getStringSerializer().deserialize(channelByte); // 渠道名称转换 String patternStr = new String(pattern); + System.out.println(message); System.out.println(patternStr); System.out.println("---频道---: " + channel); System.out.println("---消息内容---: " + msg); @@ -65,10 +80,28 @@ public class RedisMessageListener implements MessageListener { collectMachineGps.setAltitude((long) t0200.getAltitude()); collectMachineGps.setSpeed((long) t0200.getSpeed()); collectMachineGps.setCreateTime(DateUtils.getNowDate()); + //插入GPS记录表 iCollectMachineGpsService.insertCollectMachineGps(collectMachineGps); + //插入车辆GPS记录表 + BaseCarGpsRecord baseCarGpsRecord=new BaseCarGpsRecord(); + baseCarGpsRecord.setId(UUID.randomUUID().toString()); + // baseCarGpsRecord.setFireState((long) 1); + baseCarGpsRecord.setLatitude(((double)t0200.getLatitude()/1000000)); + baseCarGpsRecord.setLongitude(((double)t0200.getLongitude()/1000000)); + baseCarGpsRecord.setGpsDate(t0200.getDeviceTime().toLocalDate()); + baseCarGpsRecord.setGpsTime(t0200.getDeviceTime().toLocalTime()); + baseCarGpsRecord.setCreateTime(DateUtils.getNowDate()); + iBaseCarGpsRecordService.insertBaseCarGpsRecord(baseCarGpsRecord); + //更新车辆最新位置 + BaseCar baseCar = new BaseCar(); + baseCar.setLatitude(((double)t0200.getLatitude()/1000000)); + baseCar.setLongitude(((double)t0200.getLongitude()/1000000)); + baseCar.setDeviceId(t0200.getClientId()); + iBaseCarService.updateCarGPS(baseCar); break; } } + } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarGpsRecordService.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarGpsRecordService.java new file mode 100644 index 0000000..9be7198 --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarGpsRecordService.java @@ -0,0 +1,61 @@ +package com.ruoyi.basetyre.service; + +import java.util.List; +import com.ruoyi.basetyre.domain.BaseCarGpsRecord; + +/** + * 车辆GPS记录Service接口 + * + * @author Yangwl + * @date 2023-03-14 + */ +public interface IBaseCarGpsRecordService +{ + /** + * 查询车辆GPS记录 + * + * @param id 车辆GPS记录主键 + * @return 车辆GPS记录 + */ + public BaseCarGpsRecord selectBaseCarGpsRecordById(String id); + + /** + * 查询车辆GPS记录列表 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 车辆GPS记录集合 + */ + public List selectBaseCarGpsRecordList(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 新增车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + public int insertBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 修改车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + public int updateBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord); + + /** + * 批量删除车辆GPS记录 + * + * @param ids 需要删除的车辆GPS记录主键集合 + * @return 结果 + */ + public int deleteBaseCarGpsRecordByIds(String[] ids); + + /** + * 删除车辆GPS记录信息 + * + * @param id 车辆GPS记录主键 + * @return 结果 + */ + public int deleteBaseCarGpsRecordById(String id); +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarService.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarService.java index b5b6f61..1046a6b 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarService.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseCarService.java @@ -2,6 +2,7 @@ package com.ruoyi.basetyre.service; import java.util.List; import com.ruoyi.basetyre.domain.BaseCar; +import com.ruoyi.basetyre.domain.vo.CarTyres; /** * 车辆基础信息Service接口 @@ -79,4 +80,8 @@ public interface IBaseCarService public String checkCarLicenseUnique(BaseCar baseCar); List selectGpsCarList(BaseCar baseCar); + + int updateCarGPS(BaseCar baseCar); + + List selectCarTyres(BaseCar baseCar); } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreHistoricalRecordsService.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreHistoricalRecordsService.java new file mode 100644 index 0000000..b95c20a --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreHistoricalRecordsService.java @@ -0,0 +1,61 @@ +package com.ruoyi.basetyre.service; + +import java.util.List; +import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords; + +/** + * 轮胎历史Service接口 + * + * @author Yangwl + * @date 2023-03-13 + */ +public interface IBaseTyreHistoricalRecordsService +{ + /** + * 查询轮胎历史 + * + * @param id 轮胎历史主键 + * @return 轮胎历史 + */ + public BaseTyreHistoricalRecords selectBaseTyreHistoricalRecordsById(String id); + + /** + * 查询轮胎历史列表 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 轮胎历史集合 + */ + public List selectBaseTyreHistoricalRecordsList(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 新增轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + public int insertBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 修改轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + public int updateBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords); + + /** + * 批量删除轮胎历史 + * + * @param ids 需要删除的轮胎历史主键集合 + * @return 结果 + */ + public int deleteBaseTyreHistoricalRecordsByIds(String[] ids); + + /** + * 删除轮胎历史信息 + * + * @param id 轮胎历史主键 + * @return 结果 + */ + public int deleteBaseTyreHistoricalRecordsById(String id); +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreService.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreService.java index 95682d1..707b8a6 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreService.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/IBaseTyreService.java @@ -1,7 +1,11 @@ package com.ruoyi.basetyre.service; import java.util.List; + + import com.ruoyi.basetyre.domain.BaseTyre; +import com.ruoyi.basetyre.domain.vo.CarTyres; +import com.ruoyi.common.core.domain.AjaxResult; /** * 轮胎基础Service接口 @@ -9,7 +13,7 @@ import com.ruoyi.basetyre.domain.BaseTyre; * @author Yangwl * @date 2023-02-27 */ -public interface IBaseTyreService +public interface IBaseTyreService { /** * 查询轮胎基础 @@ -58,4 +62,16 @@ public interface IBaseTyreService * @return 结果 */ public int deleteBaseTyreById(String id); + + public AjaxResult insertBaseTyreList(BaseTyre baseTyre); + + AjaxResult tyreInstall(CarTyres carTyres); + + public BaseTyre getTyreInfoById(String outerTireNumber); + + public AjaxResult TyreUnInstall(CarTyres carTyres); + + AjaxResult getTyreLife(String outerTireNumber); + + String checkBaseTyreUnique(BaseTyre baseTyre); } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarGpsRecordServiceImpl.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarGpsRecordServiceImpl.java new file mode 100644 index 0000000..9dd1488 --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarGpsRecordServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.basetyre.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.basetyre.mapper.BaseCarGpsRecordMapper; +import com.ruoyi.basetyre.domain.BaseCarGpsRecord; +import com.ruoyi.basetyre.service.IBaseCarGpsRecordService; + +/** + * 车辆GPS记录Service业务层处理 + * + * @author Yangwl + * @date 2023-03-14 + */ +@Service +public class BaseCarGpsRecordServiceImpl implements IBaseCarGpsRecordService +{ + @Autowired + private BaseCarGpsRecordMapper baseCarGpsRecordMapper; + + /** + * 查询车辆GPS记录 + * + * @param id 车辆GPS记录主键 + * @return 车辆GPS记录 + */ + @Override + public BaseCarGpsRecord selectBaseCarGpsRecordById(String id) + { + return baseCarGpsRecordMapper.selectBaseCarGpsRecordById(id); + } + + /** + * 查询车辆GPS记录列表 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 车辆GPS记录 + */ + @Override + public List selectBaseCarGpsRecordList(BaseCarGpsRecord baseCarGpsRecord) + { + return baseCarGpsRecordMapper.selectBaseCarGpsRecordList(baseCarGpsRecord); + } + + /** + * 新增车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + @Override + public int insertBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord) + { + baseCarGpsRecord.setCreateTime(DateUtils.getNowDate()); + return baseCarGpsRecordMapper.insertBaseCarGpsRecord(baseCarGpsRecord); + } + + /** + * 修改车辆GPS记录 + * + * @param baseCarGpsRecord 车辆GPS记录 + * @return 结果 + */ + @Override + public int updateBaseCarGpsRecord(BaseCarGpsRecord baseCarGpsRecord) + { + return baseCarGpsRecordMapper.updateBaseCarGpsRecord(baseCarGpsRecord); + } + + /** + * 批量删除车辆GPS记录 + * + * @param ids 需要删除的车辆GPS记录主键 + * @return 结果 + */ + @Override + public int deleteBaseCarGpsRecordByIds(String[] ids) + { + return baseCarGpsRecordMapper.deleteBaseCarGpsRecordByIds(ids); + } + + /** + * 删除车辆GPS记录信息 + * + * @param id 车辆GPS记录主键 + * @return 结果 + */ + @Override + public int deleteBaseCarGpsRecordById(String id) + { + return baseCarGpsRecordMapper.deleteBaseCarGpsRecordById(id); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarServiceImpl.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarServiceImpl.java index e072154..faaec97 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarServiceImpl.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseCarServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.basetyre.service.impl; import java.util.List; import java.util.UUID; +import com.ruoyi.basetyre.domain.vo.CarTyres; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -120,4 +121,14 @@ public class BaseCarServiceImpl implements IBaseCarService public List selectGpsCarList(BaseCar baseCar) { return baseCarMapper.selectGpsCarList(baseCar); } + + @Override + public int updateCarGPS(BaseCar baseCar) { + return baseCarMapper.updateCarGPS(baseCar); + } + + @Override + public List selectCarTyres(BaseCar baseCar) { + return baseCarMapper.selectCarTyres(baseCar); + } } diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java new file mode 100644 index 0000000..7c67287 --- /dev/null +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.basetyre.service.impl; + +import java.util.List; + +import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords; +import com.ruoyi.basetyre.service.IBaseTyreHistoricalRecordsService; + +/** + * 轮胎历史Service业务层处理 + * + * @author Yangwl + * @date 2023-03-13 + */ +@Service +public class BaseTyreHistoricalRecordsServiceImpl implements IBaseTyreHistoricalRecordsService +{ + @Autowired + private BaseTyreHistoricalRecordsMapper baseTyreHistoricalRecordsMapper; + + /** + * 查询轮胎历史 + * + * @param id 轮胎历史主键 + * @return 轮胎历史 + */ + @Override + public BaseTyreHistoricalRecords selectBaseTyreHistoricalRecordsById(String id) + { + return baseTyreHistoricalRecordsMapper.selectBaseTyreHistoricalRecordsById(id); + } + + /** + * 查询轮胎历史列表 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 轮胎历史 + */ + @Override + public List selectBaseTyreHistoricalRecordsList(BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + return baseTyreHistoricalRecordsMapper.selectBaseTyreHistoricalRecordsList(baseTyreHistoricalRecords); + } + + /** + * 新增轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + @Override + public int insertBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate()); + return baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords); + } + + /** + * 修改轮胎历史 + * + * @param baseTyreHistoricalRecords 轮胎历史 + * @return 结果 + */ + @Override + public int updateBaseTyreHistoricalRecords(BaseTyreHistoricalRecords baseTyreHistoricalRecords) + { + return baseTyreHistoricalRecordsMapper.updateBaseTyreHistoricalRecords(baseTyreHistoricalRecords); + } + + /** + * 批量删除轮胎历史 + * + * @param ids 需要删除的轮胎历史主键 + * @return 结果 + */ + @Override + public int deleteBaseTyreHistoricalRecordsByIds(String[] ids) + { + return baseTyreHistoricalRecordsMapper.deleteBaseTyreHistoricalRecordsByIds(ids); + } + + /** + * 删除轮胎历史信息 + * + * @param id 轮胎历史主键 + * @return 结果 + */ + @Override + public int deleteBaseTyreHistoricalRecordsById(String id) + { + return baseTyreHistoricalRecordsMapper.deleteBaseTyreHistoricalRecordsById(id); + } +} diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreServiceImpl.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreServiceImpl.java index 1314d3b..7422f91 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreServiceImpl.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreServiceImpl.java @@ -1,28 +1,56 @@ package com.ruoyi.basetyre.service.impl; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import com.ruoyi.basetyre.domain.BaseDevice; +import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords; +import com.ruoyi.basetyre.domain.vo.CarTyres; +import com.ruoyi.basetyre.domain.vo.TyresLife; +import com.ruoyi.basetyre.mapper.BaseDeviceMapper; +import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import org.apache.ibatis.session.SqlSessionFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.basetyre.mapper.BaseTyreMapper; import com.ruoyi.basetyre.domain.BaseTyre; import com.ruoyi.basetyre.service.IBaseTyreService; +import javax.annotation.Resource; + /** * 轮胎基础Service业务层处理 - * + * * @author Yangwl * @date 2023-02-27 */ @Service -public class BaseTyreServiceImpl implements IBaseTyreService +public class BaseTyreServiceImpl implements IBaseTyreService { @Autowired private BaseTyreMapper baseTyreMapper; + @Resource + private SqlSessionFactory sqlSessionFactory; + @Autowired + private BaseTyreHistoricalRecordsMapper baseTyreHistoricalRecordsMapper; + @Autowired + private BaseDeviceMapper baseDeviceMapper; /** * 查询轮胎基础 - * + * * @param id 轮胎基础主键 * @return 轮胎基础 */ @@ -34,44 +62,55 @@ public class BaseTyreServiceImpl implements IBaseTyreService /** * 查询轮胎基础列表 - * + * * @param baseTyre 轮胎基础 * @return 轮胎基础 */ @Override public List selectBaseTyreList(BaseTyre baseTyre) { + baseTyre.setIsDelete((long) 0); return baseTyreMapper.selectBaseTyreList(baseTyre); } /** * 新增轮胎基础 - * + * * @param baseTyre 轮胎基础 * @return 结果 */ @Override public int insertBaseTyre(BaseTyre baseTyre) { + + LoginUser loginUser=SecurityUtils.getLoginUser(); + baseTyre.setId(UUID.randomUUID().toString()); baseTyre.setCreateTime(DateUtils.getNowDate()); + baseTyre.setCreateName(loginUser.getUsername()); + baseTyre.setCreateBy(loginUser.getUserId().toString()); + baseTyre.setIsDelete((long) 0); return baseTyreMapper.insertBaseTyre(baseTyre); } /** * 修改轮胎基础 - * + * * @param baseTyre 轮胎基础 * @return 结果 */ @Override public int updateBaseTyre(BaseTyre baseTyre) { + LoginUser loginUser=SecurityUtils.getLoginUser(); + baseTyre.setModifyTime(DateUtils.getNowDate()); + baseTyre.setModifyBy(loginUser.getUserId().toString()); + baseTyre.setModifyName(loginUser.getUsername()); return baseTyreMapper.updateBaseTyre(baseTyre); } /** * 批量删除轮胎基础 - * + * * @param ids 需要删除的轮胎基础主键 * @return 结果 */ @@ -83,7 +122,7 @@ public class BaseTyreServiceImpl implements IBaseTyreService /** * 删除轮胎基础信息 - * + * * @param id 轮胎基础主键 * @return 结果 */ @@ -92,4 +131,193 @@ public class BaseTyreServiceImpl implements IBaseTyreService { return baseTyreMapper.deleteBaseTyreById(id); } + + @Override + public AjaxResult insertBaseTyreList(BaseTyre baseTyre) { + + try { + LoginUser loginUser= SecurityUtils.getLoginUser(); + baseTyre.setId(UUID.randomUUID().toString()); + baseTyre.setIsDelete((long) 0); + baseTyre.setCreateTime(DateUtils.getNowDate()); + baseTyre.setCreateName(loginUser.getUsername()); + baseTyre.setCreateBy(loginUser.getUserId().toString()); + baseTyreMapper.insertBaseTyre(baseTyre); + return AjaxResult.success(); + }catch (Exception e){ + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } +// boolean flag = false; +// List BaseTyresVOS = baseTyreList.stream().map(baseTyre -> { +// BaseTyre baseTyreVO = new BaseTyre(); +// BeanUtils.copyProperties(baseTyre, baseTyreVO); +// baseTyreVO.setId(UUID.randomUUID().toString()); +// baseTyreVO.setIsDelete((long) 0); +// baseTyreVO.setCreateTime(DateUtils.getNowDate()); +// baseTyreVO.setCreateName("MOM"); +// return baseTyreVO; +// }).collect(Collectors.toList()); +// try { +// flag = baseTyreMapper.insertBaseTyreList(BaseTyresVOS); +// if (flag){ +// return AjaxResult.success(); +// }else { +// return AjaxResult.error(); +// } +// +// } catch (Exception e) { +// return AjaxResult.error(e.getMessage()); +// } + +// SqlSession sqlSession=sqlSessionFactory.openSession(ExecutorType.BATCH); +// try{ +// baseTyreMapper=sqlSession.getMapper(BaseTyreMapper.class); +// BaseTyresVOS.stream().forEach(e->{ +// baseTyreMapper.insertBaseTyre(e); +// }); +// sqlSession.clearCache(); +// sqlSession.commit(); +// }catch(Exception e){ +// e.printStackTrace(); +// }finally{ +// sqlSession.close(); +// }} + + + @Override + public AjaxResult tyreInstall(CarTyres carTyres) { + BaseTyre baseTyre=new BaseTyre(); + LoginUser loginUser= SecurityUtils.getLoginUser(); + /** + * 验证 + */ + //传感器是否存在 + if (StringUtils.isEmpty(carTyres.getSensorId())){ + //传感器是否存在 + BaseDevice baseDevice=new BaseDevice(); + baseDevice.setInternetThingsNo(carTyres.getSensorId()); + List baseDeviceList = baseDeviceMapper.selectBaseDeviceList(baseDevice); + if (baseDeviceList==null || baseDeviceList.size()==0){ + return AjaxResult.error("系统无传感器信息!"); + } + } + try { + //执行安装更换操作 + baseTyre.setId(carTyres.getTyreId()); + baseTyre.setCarLicense(carTyres.getCarLicense()); + baseTyre.setCarId(carTyres.getCarId()); + baseTyre.setSensorId(carTyres.getSensorId()); + baseTyre.setTyrePosition(carTyres.getTyrePosition()); + baseTyre.setCurrentTextureDepth(carTyres.getCurrentTextureDepth()); + baseTyre.setModifyId(loginUser.getUserId().toString()); + baseTyre.setModifyBy(loginUser.getUsername()); + baseTyre.setModifyName(loginUser.getUsername()); + baseTyre.setModifyTime(DateUtils.getNowDate()); + BaseTyre baseT=baseTyreMapper.selectBaseTyreById(carTyres.getTyreId()); + Long type = Long.valueOf(carTyres.getType()); + if (!StringUtils.isEmpty(baseT.getCarLicense()) && !StringUtils.isEmpty(baseT.getTyrePosition()) && !carTyres.getType().equals("4")){ + type=Long.valueOf(2); + } + baseTyreMapper.updateBaseTyre(baseTyre); + //生成安装更换记录 + BaseTyreHistoricalRecords baseTyreHistoricalRecords=new BaseTyreHistoricalRecords(); + baseTyreHistoricalRecords.setId(UUID.randomUUID().toString()); + baseTyreHistoricalRecords.setTyreId(carTyres.getTyreId()); + baseTyreHistoricalRecords.setTyrePosition(carTyres.getTyrePosition()); + baseTyreHistoricalRecords.setCarId(carTyres.getCarId()); + baseTyreHistoricalRecords.setCarLicense(carTyres.getCarLicense()); + /** + * 查询此车辆轴位轮胎是否有轮胎,有的话执行更换操作 + */ + + baseTyreHistoricalRecords.setType(type); + baseTyreHistoricalRecords.setTextureDepth(carTyres.getCurrentTextureDepth()); + baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate()); + baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords); + }catch (Exception e){ + return AjaxResult.error(e.getMessage()); + } + return AjaxResult.success(); + } + + + + @Override + public AjaxResult TyreUnInstall(CarTyres carTyres) { + + BaseTyre baseTyre=new BaseTyre(); + LoginUser loginUser= SecurityUtils.getLoginUser(); + try { + //卸胎解绑 + baseTyre.setId(carTyres.getTyreId()); + baseTyre.setCurrentTextureDepth(carTyres.getCurrentTextureDepth()); + baseTyre.setModifyId(loginUser.getUserId().toString()); + baseTyre.setModifyBy(loginUser.getUsername()); + baseTyre.setModifyName(loginUser.getUsername()); + baseTyre.setModifyTime(DateUtils.getNowDate()); + baseTyreMapper.UnInstallTyre(baseTyre); + //生成记录 + BaseTyreHistoricalRecords baseTyreHistoricalRecords=new BaseTyreHistoricalRecords(); + baseTyreHistoricalRecords.setId(UUID.randomUUID().toString()); + baseTyreHistoricalRecords.setTyreId(carTyres.getTyreId()); + baseTyreHistoricalRecords.setTyrePosition(carTyres.getTyrePosition()); + baseTyreHistoricalRecords.setCarId(carTyres.getCarId()); + baseTyreHistoricalRecords.setCarLicense(carTyres.getCarLicense()); + baseTyreHistoricalRecords.setType(Long.valueOf(carTyres.getType())); + baseTyreHistoricalRecords.setTextureDepth(carTyres.getCurrentTextureDepth()); + baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate()); + baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords); + }catch (Exception e){ + return AjaxResult.error(e.getMessage()); + } + return AjaxResult.success(); + } + + @Override + public AjaxResult getTyreLife(String outerTireNumber) { + try { + BaseTyre baseTyre=baseTyreMapper.getTyreInfoById(outerTireNumber); + TyresLife tyresLife = new TyresLife(); + tyresLife.setDatetime(baseTyre.getCreateTime()); + tyresLife.setDescription("MOM数据下发"); + List lifeList=new ArrayList<>(); + lifeList.add(tyresLife); + BaseTyreHistoricalRecords baseTyreHistoricalRecords=new BaseTyreHistoricalRecords(); + baseTyreHistoricalRecords.setTyreId(baseTyre.getId()); + List list = baseTyreHistoricalRecordsMapper.selectBaseTyreHistoricalRecordsList(baseTyreHistoricalRecords); + for (BaseTyreHistoricalRecords bthr: list) { + TyresLife tyresLifeVo = new TyresLife(); + tyresLifeVo.setDatetime(bthr.getCreateTime()); + tyresLifeVo.setDescription(String.valueOf(bthr.getType())); + tyresLifeVo.setCarLicence(bthr.getCarLicense()); + tyresLifeVo.setCarPosition(bthr.getTyrePosition()); + lifeList.add(tyresLifeVo); + } + return AjaxResult.success(lifeList); + }catch (Exception e){ + return AjaxResult.error(e.getMessage()); + } + + + + } + + @Override + public String checkBaseTyreUnique(BaseTyre baseTyre) { + BaseTyre info = baseTyreMapper.checkBaseTyreUnique(baseTyre.getOuterTireNumber()); + if (StringUtils.isNotNull(info) && baseTyre.getOuterTireNumber().equals(info.getOuterTireNumber())) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + @Override + public BaseTyre getTyreInfoById(String outerTireNumber) { + return baseTyreMapper.getTyreInfoById(outerTireNumber); + } + + + } diff --git a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarGpsRecordMapper.xml b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarGpsRecordMapper.xml new file mode 100644 index 0000000..07017dc --- /dev/null +++ b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarGpsRecordMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + select id, tyre_fac_code, company_code, car_id, device_id, fire_state, longitude, latitude, gps_date, gps_time, car_online_mileage, create_time from base_car_gps_record + + + + + + + + insert into base_car_gps_record + + id, + tyre_fac_code, + company_code, + car_id, + device_id, + fire_state, + longitude, + latitude, + gps_date, + gps_time, + car_online_mileage, + create_time, + + + #{id}, + #{tyreFacCode}, + #{companyCode}, + #{carId}, + #{deviceId}, + #{fireState}, + #{longitude}, + #{latitude}, + #{gpsDate}, + #{gpsTime}, + #{carOnlineMileage}, + #{createTime}, + + + + + update base_car_gps_record + + tyre_fac_code = #{tyreFacCode}, + company_code = #{companyCode}, + car_id = #{carId}, + device_id = #{deviceId}, + fire_state = #{fireState}, + longitude = #{longitude}, + latitude = #{latitude}, + gps_date = #{gpsDate}, + gps_time = #{gpsTime}, + car_online_mileage = #{carOnlineMileage}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from base_car_gps_record where id = #{id} + + + + delete from base_car_gps_record where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarMapper.xml b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarMapper.xml index 231899f..9eac325 100644 --- a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarMapper.xml +++ b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseCarMapper.xml @@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -34,6 +35,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + @@ -56,7 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN base_car_queue bcq ON bc.car_queue_id = bcq.id LEFT JOIN base_car_type bct ON bct.id = bc.car_type_id - and bc.car_license = #{carLicense} + and bc.id = #{id} + and bc.car_license like concat('%', #{carLicense}, '%') + @@ -98,12 +120,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + insert into base_car @@ -206,6 +241,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" modify_by = #{modifyBy}, where id = #{id} + @@ -220,5 +256,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + update base_car + + longitude = #{longitude}, + latitude = #{latitude}, + + + and device_id = #{deviceId} + and car_license = #{carLicense} + + \ No newline at end of file diff --git a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreHistoricalRecordsMapper.xml b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreHistoricalRecordsMapper.xml new file mode 100644 index 0000000..2a9d28b --- /dev/null +++ b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreHistoricalRecordsMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + select id, tyre_id, tyre_position, tyre_position_num, car_id, car_license, type, texture_depth, create_time from base_tyre_historical_records + + + + + + + + insert into base_tyre_historical_records + + id, + tyre_id, + tyre_position, + tyre_position_num, + car_id, + car_license, + type, + texture_depth, + create_time, + + + #{id}, + #{tyreId}, + #{tyrePosition}, + #{tyrePositionNum}, + #{carId}, + #{carLicense}, + #{type}, + #{textureDepth}, + #{createTime}, + + + + + update base_tyre_historical_records + + tyre_id = #{tyreId}, + tyre_position = #{tyrePosition}, + tyre_position_num = #{tyrePositionNum}, + car_id = #{carId}, + car_license = #{carLicense}, + type = #{type}, + texture_depth = #{textureDepth}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from base_tyre_historical_records where id = #{id} + + + + delete from base_tyre_historical_records where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreMapper.xml b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreMapper.xml index 39eaaec..ae1bb72 100644 --- a/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreMapper.xml +++ b/ruoyi-basetyre/src/main/resources/mapper/basetyre/BaseTyreMapper.xml @@ -108,14 +108,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and modify_id = #{modifyId} and modify_by = #{modifyBy} and modify__name like concat('%', #{modifyName}, '%') + + - + + + + insert into base_tyre @@ -221,6 +236,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, + + insert into base_tyre (id, tyre_factory, outer_tire_number, material_code, material_name, + quality_status, unit, material_type, material_group, product_group, brand, category, size, + pattern, cons_pattern, hierarchy, speed_level, load_index, rim_size, weight, section_width, + outer_diameter, flattening, enhanced, inner_tube, pattern_depth, ctn, type, cert_info, customs_spe, + fe_code, fe_desc, produce_factory, car_id, car_license, tyre_position, sensor_id, current_texture_depth, + state, is_delete, create_time, create_id, create_by, create_name ) + values + + + #{t.id}, + #{t.tyreFactory}, + #{t.outerTireNumber}, + #{t.materialCode}, + #{t.materialName}, + #{t.qualityStatus}, + #{t.unit}, + #{t.materialType}, + #{t.materialGroup}, + #{t.productGroup}, + #{t.brand}, + #{t.category}, + #{t.size}, + #{t.pattern}, + #{t.consPattern}, + #{t.hierarchy}, + #{t.speedLevel}, + #{t.loadIndex}, + #{t.rimSize}, + #{t.weight}, + #{t.sectionWidth}, + #{t.outerDiameter}, + #{t.flattening}, + #{t.enhanced}, + #{t.innerTube}, + #{t.patternDepth}, + #{t.ctn}, + #{t.type}, + #{t.certInfo}, + #{t.customsSpe}, + #{t.feCode}, + #{t.feDesc}, + #{t.produceFactory}, + #{t.carId}, + #{t.carLicense}, + #{t.tyrePosition}, + #{t.sensorId}, + #{t.currentTextureDepth}, + #{t.state}, + #{t.isDelete}, + #{t.createTime}, + #{t.createId}, + #{t.createBy}, + #{t.createName} + + + + + + + + + + update base_tyre @@ -276,15 +355,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + update base_tyre set car_license=null,car_id=null ,sensor_id=null ,tyre_position=null ,modify_time = #{modifyTime},modify_id = #{modifyId},modify_by = #{modifyBy},modify__name = #{modifyName},current_texture_depth = #{currentTextureDepth} where id = #{id} + - - delete from base_tyre where id = #{id} - - - delete from base_tyre where id in + + + + + + update base_tyre set is_delete = '1' where id = #{id} + + + + update base_tyre set is_delete = '1' where id in #{id} - + \ No newline at end of file diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index b7bd279..0ba11fa 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -147,6 +147,13 @@ lombok + + + org.apache.httpcomponents + httpclient + 4.3.5 + + diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production index c3eea40..f194e6e 100644 --- a/ruoyi-ui/.env.production +++ b/ruoyi-ui/.env.production @@ -6,6 +6,6 @@ VITE_APP_ENV = 'production' # 若依管理系统/生产环境 VITE_APP_BASE_API = 'http://10.11.41.249:8080/dev-api' - +# VITE_APP_BASE_API = 'http://47.94.93.46:80/dev-api' # 是否在打包时开启压缩,支持 gzip 和 brotli VITE_BUILD_COMPRESS = gzip \ No newline at end of file diff --git a/ruoyi-ui/src/api/basetyre/basetyre.js b/ruoyi-ui/src/api/basetyre/basetyre.js index 17d90ca..40d7337 100644 --- a/ruoyi-ui/src/api/basetyre/basetyre.js +++ b/ruoyi-ui/src/api/basetyre/basetyre.js @@ -12,7 +12,7 @@ export function listBasetyre(query) { // 查询基础信息详细 export function getBasetyre(id) { return request({ - url: '/basetyre/basetyre/' + id, + url: '/basetyre/tyre/' + id, method: 'get' }) } @@ -20,7 +20,7 @@ export function getBasetyre(id) { // 新增信息 export function addBasetyre(data) { return request({ - url: '/basetyre/basetyre', + url: '/basetyre/tyre', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addBasetyre(data) { // 修改信息 export function updateBasetyre(data) { return request({ - url: '/basetyre/basetyre', + url: '/basetyre/tyre', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateBasetyre(data) { // 删除轮胎基础信息 export function delBasetyre(id) { return request({ - url: '/basetyre/basetyre/' + id, + url: '/basetyre/tyre/' + id, method: 'delete' }) } diff --git a/ruoyi-ui/src/views/report/temppresspeed/index.vue b/ruoyi-ui/src/views/report/temppresspeed/index.vue new file mode 100644 index 0000000..712513c --- /dev/null +++ b/ruoyi-ui/src/views/report/temppresspeed/index.vue @@ -0,0 +1,313 @@ + + + diff --git a/ruoyi-ui/src/views/tireManagement/info/index.vue b/ruoyi-ui/src/views/tireManagement/info/index.vue index cad8d58..14e0cf3 100644 --- a/ruoyi-ui/src/views/tireManagement/info/index.vue +++ b/ruoyi-ui/src/views/tireManagement/info/index.vue @@ -115,7 +115,6 @@ - @@ -162,6 +161,7 @@ + . @@ -179,22 +179,19 @@ - - - - - - + + - - + + - - + + - - - + + + + { proxy: { // https://cn.vitejs.dev/config/#server-proxy '/dev-api': { - target: 'http://10.10.42.32:8080', - // target: 'http://localhost:8080', + // target: 'http://10.10.42.32:8080', + target: 'http://localhost:8080', changeOrigin: true, rewrite: (p) => p.replace(/^\/dev-api/, '') }