新增文件

master
Yangwl 1 year ago
parent e6da1d36cc
commit 7b3737e83b

@ -27,6 +27,7 @@
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>

@ -3,6 +3,7 @@ package com.ruoyi.basetyre.controller;
import com.ruoyi.basetyre.domain.BaseDevice;
import com.ruoyi.basetyre.service.IBaseDeviceService;
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;
@ -71,6 +72,10 @@ public class BaseDeviceController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BaseDevice baseDevice)
{
if (UserConstants.NOT_UNIQUE.equals(baseDeviceService.checkBaseDeviceUnique(baseDevice)))
{
return error("新增设备'" + baseDevice.getInternetThingsNo()+ "'失败,设备已存在");
}
return toAjax(baseDeviceService.insertBaseDevice(baseDevice));
}

@ -0,0 +1,109 @@
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.BaseElectronicFence;
import com.ruoyi.basetyre.service.IBaseElectronicFenceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yangwl
* @date 2023-04-07
*/
@RestController
@RequestMapping("/basetyre/fence")
public class BaseElectronicFenceController extends BaseController
{
@Autowired
private IBaseElectronicFenceService baseElectronicFenceService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:list')")
@GetMapping("/list")
public TableDataInfo list(BaseElectronicFence baseElectronicFence)
{
startPage();
List<BaseElectronicFence> list = baseElectronicFenceService.selectBaseElectronicFenceList(baseElectronicFence);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:export')")
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseElectronicFence baseElectronicFence)
{
List<BaseElectronicFence> list = baseElectronicFenceService.selectBaseElectronicFenceList(baseElectronicFence);
ExcelUtil<BaseElectronicFence> util = new ExcelUtil<BaseElectronicFence>(BaseElectronicFence.class);
util.exportExcel(response, list, "电子围栏数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(baseElectronicFenceService.selectBaseElectronicFenceById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:add')")
@Log(title = "电子围栏", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(List<BaseElectronicFence> baseElectronicFenceList)
{
for (BaseElectronicFence baseElectronicFence:
baseElectronicFenceList ) {
baseElectronicFenceService.insertBaseElectronicFence(baseElectronicFence);
}
return null;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:edit')")
@Log(title = "电子围栏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseElectronicFence baseElectronicFence)
{
return toAjax(baseElectronicFenceService.updateBaseElectronicFence(baseElectronicFence));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('basetyre:fence:remove')")
@Log(title = "电子围栏", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(baseElectronicFenceService.deleteBaseElectronicFenceByIds(ids));
}
}

@ -1,6 +1,7 @@
package com.ruoyi.basetyre.controller;
import com.ruoyi.basetyre.domain.BaseTyre;
import com.ruoyi.basetyre.domain.CollectTyresDetail;
import com.ruoyi.basetyre.domain.vo.CarTyres;
import com.ruoyi.basetyre.service.IBaseTyreService;
import com.ruoyi.common.annotation.Log;
@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -194,7 +196,9 @@ public class BaseTyreController extends BaseController
public AjaxResult TyreMileage(@RequestBody CarTyres carTyres){
return baseTyreService.TyreMileage(carTyres);
}
@PostMapping("/TyreWarring")
public AjaxResult TyreWarring(@RequestBody CollectTyresDetail collectTyresDetail) throws IOException {
return baseTyreService.TyreWaringReprt(collectTyresDetail);
}
}

@ -0,0 +1,44 @@
package com.ruoyi.basetyre.controller;
import com.ruoyi.basetyre.domain.BaseCar;
import com.ruoyi.basetyre.domain.BaseTyre;
import com.ruoyi.basetyre.service.IBaseCarService;
import com.ruoyi.basetyre.service.IBaseTyreService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/report")
public class ReportController {
@Autowired
private IBaseCarService iBaseCarService;
@Autowired
private IBaseTyreService iBaseTyreService;
@PostMapping("/indexreport")
public AjaxResult indexreport()
{
Map map=new HashMap();
List<BaseCar> baseCarList=iBaseCarService.selectBaseCarList(new BaseCar());
map.put("carMap",baseCarList);
map.put("carTotal",baseCarList.size());
baseCarList=baseCarList.stream().filter(item-> !StringUtils.isBlank(item.getDeviceId())).collect(Collectors.toList());
map.put("carBindGps",baseCarList.size());
List<BaseTyre> baseTyreList =iBaseTyreService.selectBaseTyreList(new BaseTyre());
map.put("tyreTotal",baseTyreList.size());
baseTyreList=baseTyreList.stream().filter(item-> !StringUtils.isBlank(item.getSensorId())).collect(Collectors.toList());
map.put("tyreBindSensor",baseTyreList.size());
return AjaxResult.success(map);
}
}

@ -0,0 +1,155 @@
package com.ruoyi.basetyre.domain;
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;
/**
* base_electronic_fence
*
* @author Yangwl
* @date 2023-04-07
*/
public class BaseElectronicFence extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 车辆id */
@Excel(name = "车辆id")
private String carId;
/** 维度 */
@Excel(name = "维度")
private Long latitude;
/** 经度 */
@Excel(name = "经度")
private Long longitude;
/** 创建人姓名 */
@Excel(name = "创建人姓名")
private String createName;
/** 编辑时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "编辑时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date modifyTime;
/** 编辑人 */
@Excel(name = "编辑人")
private String modifyBy;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String other1;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String other2;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setCarId(String carId)
{
this.carId = carId;
}
public String getCarId()
{
return carId;
}
public void setLatitude(Long latitude)
{
this.latitude = latitude;
}
public Long getLatitude()
{
return latitude;
}
public void setLongitude(Long longitude)
{
this.longitude = longitude;
}
public Long getLongitude()
{
return longitude;
}
public void setCreateName(String createName)
{
this.createName = createName;
}
public String getCreateName()
{
return createName;
}
public void setModifyTime(Date modifyTime)
{
this.modifyTime = modifyTime;
}
public Date getModifyTime()
{
return modifyTime;
}
public void setModifyBy(String modifyBy)
{
this.modifyBy = modifyBy;
}
public String getModifyBy()
{
return modifyBy;
}
public void setOther1(String other1)
{
this.other1 = other1;
}
public String getOther1()
{
return other1;
}
public void setOther2(String other2)
{
this.other2 = other2;
}
public String getOther2()
{
return other2;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("carId", getCarId())
.append("latitude", getLatitude())
.append("longitude", getLongitude())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("createName", getCreateName())
.append("modifyTime", getModifyTime())
.append("modifyBy", getModifyBy())
.append("remark", getRemark())
.append("other1", getOther1())
.append("other2", getOther2())
.toString();
}
}

@ -210,8 +210,17 @@ public class BaseTyre extends BaseEntity
private String temperature;
//压力
private String pressure;
//企业编码
@Excel(name = "企业")
private String companyCode;
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getTemperature() {
return temperature;

@ -128,7 +128,17 @@ public class CollectTyresDetail extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long longitude;
public void setId(String id)
private String reportTime;
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public void setId(String id)
{
this.id = id;
}

@ -14,9 +14,36 @@ public class Alarm extends BaseEntity{
private String size;
private String pressvalue;
private String temperaturevalue;
private String ispowerinvalue;
private String ispresshigh;
private String ispresslower;
private String istemperaturehigh;
private String tyrePosition;
private String reportTime;
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public String getIspowerinvalue() {
return ispowerinvalue;
}
public void setIspowerinvalue(String ispowerinvalue) {
this.ispowerinvalue = ispowerinvalue;
}
public String getTyrePosition() {
return tyrePosition;
}
public void setTyrePosition(String tyrePosition) {
this.tyrePosition = tyrePosition;
}
public String getSensorid() {

@ -28,6 +28,8 @@ public class CarTyres {
private BigDecimal currentTextureDepth;
//操作类型 1,上胎 2,换胎 3,卸胎 4,花纹变更
private String type;
//里程表读数
private int carOnlineMileage;

@ -1,10 +1,14 @@
package com.ruoyi.basetyre.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class PatternTextureReport {
private double textureDepth;
private int course;
private Data time;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}

@ -60,4 +60,6 @@ public interface BaseDeviceMapper
public int deleteBaseDeviceByIds(String[] ids);
BaseDevice selectBaseDeviceByno(BaseDevice baseDevice);
BaseDevice checkBaseDeviceUnique(String internetThingsNo);
}

@ -0,0 +1,61 @@
package com.ruoyi.basetyre.mapper;
import java.util.List;
import com.ruoyi.basetyre.domain.BaseElectronicFence;
/**
* Mapper
*
* @author Yangwl
* @date 2023-04-07
*/
public interface BaseElectronicFenceMapper
{
/**
*
*
* @param id
* @return
*/
public BaseElectronicFence selectBaseElectronicFenceById(String id);
/**
*
*
* @param baseElectronicFence
* @return
*/
public List<BaseElectronicFence> selectBaseElectronicFenceList(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param baseElectronicFence
* @return
*/
public int insertBaseElectronicFence(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param baseElectronicFence
* @return
*/
public int updateBaseElectronicFence(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param id
* @return
*/
public int deleteBaseElectronicFenceById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteBaseElectronicFenceByIds(String[] ids);
}

@ -58,4 +58,6 @@ public interface IBaseDeviceService
* @return
*/
public int deleteBaseDeviceById(String id);
String checkBaseDeviceUnique(BaseDevice baseDevice);
}

@ -0,0 +1,61 @@
package com.ruoyi.basetyre.service;
import java.util.List;
import com.ruoyi.basetyre.domain.BaseElectronicFence;
/**
* Service
*
* @author Yangwl
* @date 2023-04-07
*/
public interface IBaseElectronicFenceService
{
/**
*
*
* @param id
* @return
*/
public BaseElectronicFence selectBaseElectronicFenceById(String id);
/**
*
*
* @param baseElectronicFence
* @return
*/
public List<BaseElectronicFence> selectBaseElectronicFenceList(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param baseElectronicFence
* @return
*/
public int insertBaseElectronicFence(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param baseElectronicFence
* @return
*/
public int updateBaseElectronicFence(BaseElectronicFence baseElectronicFence);
/**
*
*
* @param ids
* @return
*/
public int deleteBaseElectronicFenceByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteBaseElectronicFenceById(String id);
}

@ -1,9 +1,11 @@
package com.ruoyi.basetyre.service;
import java.io.IOException;
import java.util.List;
import com.ruoyi.basetyre.domain.BaseTyre;
import com.ruoyi.basetyre.domain.CollectTyresDetail;
import com.ruoyi.basetyre.domain.vo.CarTyres;
import com.ruoyi.common.core.domain.AjaxResult;
@ -82,4 +84,6 @@ public interface IBaseTyreService
AjaxResult TyreMileage(CarTyres carTyres);
AjaxResult EditPatternTextureDepth(CarTyres carTyres);
AjaxResult TyreWaringReprt(CollectTyresDetail collectTyresDetail) throws IOException;
}

@ -4,6 +4,7 @@ import java.util.List;
import java.util.UUID;
import com.ruoyi.basetyre.domain.BaseCarQueue;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
@ -45,6 +46,7 @@ public class BaseCarQueueServiceImpl implements IBaseCarQueueService
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseCarQueue> selectBaseCarQueueList(BaseCarQueue baseCarQueue)
{
return baseCarQueueMapper.selectBaseCarQueueList(baseCarQueue);
@ -108,6 +110,7 @@ public class BaseCarQueueServiceImpl implements IBaseCarQueueService
}
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseCarQueue> carQueuelist(BaseCarQueue baseCarQueue) {
return baseCarQueueMapper.carQueuelist(baseCarQueue);
}

@ -9,6 +9,7 @@ import com.ruoyi.basetyre.domain.BaseTyreGpsRecord;
import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords;
import com.ruoyi.basetyre.domain.vo.CarTyres;
import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
@ -61,6 +62,7 @@ public class BaseCarServiceImpl implements IBaseCarService
}
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseCar> queryList(BaseCar baseCar) {
return baseCarMapper.queryList(baseCar);
}

@ -3,6 +3,7 @@ package com.ruoyi.basetyre.service.impl;
import java.util.List;
import java.util.UUID;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
@ -45,6 +46,7 @@ public class BaseCarTypeServiceImpl implements IBaseCarTypeService
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseCarType> selectBaseCarTypeList(BaseCarType baseCarType)
{
return baseCarTypeMapper.selectBaseCarTypeList(baseCarType);

@ -3,9 +3,12 @@ package com.ruoyi.basetyre.service.impl;
import java.util.List;
import java.util.UUID;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.basetyre.mapper.BaseDeviceMapper;
@ -43,6 +46,7 @@ public class BaseDeviceServiceImpl implements IBaseDeviceService
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseDevice> selectBaseDeviceList(BaseDevice baseDevice)
{
return baseDeviceMapper.selectBaseDeviceList(baseDevice);
@ -100,4 +104,14 @@ public class BaseDeviceServiceImpl implements IBaseDeviceService
{
return baseDeviceMapper.deleteBaseDeviceById(id);
}
@Override
public String checkBaseDeviceUnique(BaseDevice baseDevice) {
BaseDevice info = baseDeviceMapper.checkBaseDeviceUnique(baseDevice.getInternetThingsNo());
if (StringUtils.isNotNull(info) && baseDevice.getInternetThingsNo().equals(info.getInternetThingsNo()))
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

@ -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.BaseElectronicFenceMapper;
import com.ruoyi.basetyre.domain.BaseElectronicFence;
import com.ruoyi.basetyre.service.IBaseElectronicFenceService;
/**
* Service
*
* @author Yangwl
* @date 2023-04-07
*/
@Service
public class BaseElectronicFenceServiceImpl implements IBaseElectronicFenceService
{
@Autowired
private BaseElectronicFenceMapper baseElectronicFenceMapper;
/**
*
*
* @param id
* @return
*/
@Override
public BaseElectronicFence selectBaseElectronicFenceById(String id)
{
return baseElectronicFenceMapper.selectBaseElectronicFenceById(id);
}
/**
*
*
* @param baseElectronicFence
* @return
*/
@Override
public List<BaseElectronicFence> selectBaseElectronicFenceList(BaseElectronicFence baseElectronicFence)
{
return baseElectronicFenceMapper.selectBaseElectronicFenceList(baseElectronicFence);
}
/**
*
*
* @param baseElectronicFence
* @return
*/
@Override
public int insertBaseElectronicFence(BaseElectronicFence baseElectronicFence)
{
baseElectronicFence.setCreateTime(DateUtils.getNowDate());
return baseElectronicFenceMapper.insertBaseElectronicFence(baseElectronicFence);
}
/**
*
*
* @param baseElectronicFence
* @return
*/
@Override
public int updateBaseElectronicFence(BaseElectronicFence baseElectronicFence)
{
return baseElectronicFenceMapper.updateBaseElectronicFence(baseElectronicFence);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteBaseElectronicFenceByIds(String[] ids)
{
return baseElectronicFenceMapper.deleteBaseElectronicFenceByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteBaseElectronicFenceById(String id)
{
return baseElectronicFenceMapper.deleteBaseElectronicFenceById(id);
}
}

@ -1,41 +1,41 @@
package com.ruoyi.basetyre.service.impl;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.basetyre.domain.BaseDevice;
import com.ruoyi.basetyre.domain.BaseTyreHistoricalRecords;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.basetyre.domain.*;
import com.ruoyi.basetyre.domain.vo.Alarm;
import com.ruoyi.basetyre.domain.vo.CarTyres;
import com.ruoyi.basetyre.domain.vo.TyresLife;
import com.ruoyi.basetyre.domain.vo.TyresLifeInfo;
import com.ruoyi.basetyre.mapper.BaseCarMapper;
import com.ruoyi.basetyre.mapper.BaseDeviceMapper;
import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.websocket.WebSocketServer;
import com.ruoyi.common.annotation.DataScope;
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.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.websocket.WebSocketUsers;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.impl.SysUserServiceImpl;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import org.apache.ibatis.session.SqlSessionFactory;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 org.springframework.web.socket.client.WebSocketClient;
import javax.annotation.Resource;
import javax.validation.Validator;
import javax.websocket.Session;
/**
* Service
@ -62,6 +62,10 @@ public class BaseTyreServiceImpl implements IBaseTyreService
@Autowired
protected Validator validator;
@Autowired
private BaseCarMapper baseCarMapper;
/**
*
@ -82,6 +86,7 @@ public class BaseTyreServiceImpl implements IBaseTyreService
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BaseTyre> selectBaseTyreList(BaseTyre baseTyre)
{
baseTyre.setIsDelete((long) 0);
@ -301,6 +306,7 @@ public class BaseTyreServiceImpl implements IBaseTyreService
baseTyreHistoricalRecords.setCarId(carTyres.getCarId());
baseTyreHistoricalRecords.setCarLicense(carTyres.getCarLicense());
baseTyreHistoricalRecords.setType(String.valueOf(type));
baseTyreHistoricalRecords.setCarOnlineMileage(carTyres.getCarOnlineMileage());
baseTyreHistoricalRecords.setTextureDepth(carTyres.getCurrentTextureDepth());
baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate());
baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords);
@ -335,6 +341,7 @@ public class BaseTyreServiceImpl implements IBaseTyreService
baseTyreHistoricalRecords.setCarId(carTyres.getCarId());
baseTyreHistoricalRecords.setCarLicense(carTyres.getCarLicense());
baseTyreHistoricalRecords.setType(String.valueOf(carTyres.getType()));
baseTyreHistoricalRecords.setCarOnlineMileage(carTyres.getCarOnlineMileage());
baseTyreHistoricalRecords.setTextureDepth(carTyres.getCurrentTextureDepth());
baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate());
baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords);
@ -474,7 +481,7 @@ public class BaseTyreServiceImpl implements IBaseTyreService
@Override
public AjaxResult EditPatternTextureDepth(CarTyres carTyres) {
if (carTyres.getType().equals(4)){
if (carTyres.getType().equals("4")){
//更新车辆最新的花纹深度
BaseTyre baseTyre = new BaseTyre();
baseTyre.setId(carTyres.getTyreId());
@ -482,8 +489,49 @@ public class BaseTyreServiceImpl implements IBaseTyreService
baseTyreMapper.updateBaseTyre(baseTyre);
//插入一条新记录
BaseTyreHistoricalRecords baseTyreHistoricalRecords=new BaseTyreHistoricalRecords();
baseTyreHistoricalRecords.setId(UUID.randomUUID().toString());
baseTyreHistoricalRecords.setTyreId(carTyres.getTyreId());
baseTyreHistoricalRecords.setTyrePosition(carTyres.getTyrePosition());
baseTyreHistoricalRecords.setTyrePositionNum(Long.valueOf(carTyres.getTyrePosition().substring(carTyres.getTyrePosition().lastIndexOf("-")+1)));
baseTyreHistoricalRecords.setCarId(carTyres.getCarId());
baseTyreHistoricalRecords.setCarLicense(carTyres.getCarLicense());
baseTyreHistoricalRecords.setType(String.valueOf(carTyres.getType()));
baseTyreHistoricalRecords.setTextureDepth(carTyres.getCurrentTextureDepth());
baseTyreHistoricalRecords.setCarOnlineMileage(carTyres.getCarOnlineMileage());
baseTyreHistoricalRecords.setCreateTime(DateUtils.getNowDate());
return AjaxResult.success(baseTyreHistoricalRecordsMapper.insertBaseTyreHistoricalRecords(baseTyreHistoricalRecords));
}
return AjaxResult.error("操作错误!");
}
/**
*
* @param collectTyresDetail
* @return
*/
@Override
public AjaxResult TyreWaringReprt(CollectTyresDetail collectTyresDetail) throws IOException {
/**
* 1Websocket
* 2log
*/
if (!StringUtils.isBlank(collectTyresDetail.getCarId())){
BaseTyre baseTyre=baseTyreMapper.selectBaseTyreById(collectTyresDetail.getTyreId());
BaseCar baseCar =baseCarMapper.selectBaseCarById(collectTyresDetail.getCarId());
Alarm alarm=new Alarm();
alarm.setCarLicense(baseCar.getCarLicense());
alarm.setTyrePosition(baseTyre.getTyrePosition());
alarm.setIspowerinvalue(collectTyresDetail.getIspowerinvalue().toString());
alarm.setIspresshigh(collectTyresDetail.getIspresshigh().toString());
alarm.setIspresslower(collectTyresDetail.getIspresslower().toString());
alarm.setIstemperaturehigh(collectTyresDetail.getIstemperaturehigh().toString());
alarm.setReportTime(collectTyresDetail.getReportTime());
WebSocketServer.sendMessage(baseTyre.getCompanyCode(), JSONObject.toJSONString(alarm));
}
// Session session= WebSocketServer.USER_SESSIONS.get(loginUser.getUserId().toString());
// if (session !=null){
// session.getBasicRemote().sendText("报警了");
// }
return null;
}
@ -493,6 +541,4 @@ public class BaseTyreServiceImpl implements IBaseTyreService
return baseTyreMapper.getTyreInfoById(outerTireNumber);
}
}

@ -79,11 +79,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
base_car bc
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
left join sys_user_role ur on bc.create_by = ur.user_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
bc.is_delete != '1'
<if test="id != null and id != ''"> and bc.id = #{id} </if>
<if test="carLicense != null and carLicense != ''"> and bc.car_license like concat('%', #{carLicense}, '%') </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
<select id="selectBaseCarList" parameterType="BaseCar" resultMap="BaseCarResult">
@ -104,8 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="trailerNum != null "> and trailer_num = #{trailerNum}</if>
<if test="isHandDevice != null "> and is_hand_device = #{isHandDevice}</if>
<if test="isHasDevice != null "> and is_has_device = #{isHasDevice}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="longitude != null and longitude !='0.0' "> and longitude = #{longitude}</if>
<if test="latitude != null and latitude !='0.0'"> and latitude = #{latitude}</if>
<if test="tiresTotal != null "> and tires_total = #{tiresTotal}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="createId != null and createId != ''"> and create_id = #{createId}</if>
@ -158,7 +163,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, car_license as carLicense
from base_car
where car_license = #{carLicense}
and is_delete = '0'
</select>
<select id="selectBaseCarByGPS" parameterType="java.lang.String" resultType="com.ruoyi.basetyre.domain.BaseCar">
select car_license as carLicense from base_car

@ -35,7 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectBaseCarQueueList" parameterType="BaseCarQueue" resultMap="BaseCarQueueResult">
<include refid="selectBaseCarQueueVo"/>
select id, tyre_fac_code, company_code, title, state, group_total, car_total, is_delete, bcq.create_time, bcq.create_id, bcq.create_by, bcq.create_name, bcq.modify_time, bcq.modify_id, bcq.modify_by, bcq.modify__name
from base_car_queue bcq
left join sys_user_role ur on bcq.create_by = ur.user_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
<if test="tyreFacCode != null and tyreFacCode != ''"> and tyre_fac_code = #{tyreFacCode}</if>
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
@ -45,11 +49,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="carTotal != null "> and car_total = #{carTotal}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="createId != null and createId != ''"> and create_id = #{createId}</if>
<if test="createName != null and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
<if test="createName != null and createName != ''"> and bcq.create_name like concat('%', #{createName}, '%')</if>
<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
<if test="modifyId != null and modifyId != ''"> and modify_id = #{modifyId}</if>
<if test="modifyBy != null and modifyBy != ''"> and modify_by = #{modifyBy}</if>
<if test="modifyName != null and modifyName != ''"> and modify__name like concat('%', #{modifyName}, '%')</if>
<if test="modifyName != null and modifyName != ''"> and bcq.modify__name like concat('%', #{modifyName}, '%')</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
@ -73,9 +79,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
base_car_queue bcq
LEFT JOIN base_car bc on bcq.id = bc.car_queue_id
LEFT JOIN base_car_type bct on bct.id=bc.car_type_id
left join sys_user_role ur on bcq.create_by = ur.user_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
bcq.is_delete = '0' and bc.is_delete = '0'
<if test="title != null and title != ''"> and bcq.title = #{title}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
<select id="checkBaseCarQueueUnique" resultType="com.ruoyi.basetyre.domain.BaseCarQueue">

@ -26,11 +26,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBaseCarTypeVo">
select id, tyre_fac_code, company_code, code, title, state, axle_total, tyre_total, is_delete, create_time, create_id, create_by, create_name, modify_time, modify_id, modify_by, modify__name, trailer_num from base_car_type
select id, tyre_fac_code, company_code, code, title, state, axle_total, tyre_total, is_delete, create_time, create_id, create_by, create_name, modify_time, modify_id, modify_by, modify__name, trailer_num from base_car_type bct
</sql>
<select id="selectBaseCarTypeList" parameterType="BaseCarType" resultMap="BaseCarTypeResult">
<include refid="selectBaseCarTypeVo"/>
select id, tyre_fac_code, company_code, code, title, state, axle_total, tyre_total, is_delete, bct.create_time, create_id, bct.create_by, bct.create_name, bct.modify_time, bct.modify_id, bct.modify_by, bct.modify__name, trailer_num from base_car_type bct
left join sys_user_role ur on bct.create_by = ur.user_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
<if test="tyreFacCode != null and tyreFacCode != ''"> and tyre_fac_code = #{tyreFacCode}</if>
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
@ -47,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="modifyBy != null and modifyBy != ''"> and modify_by = #{modifyBy}</if>
<if test="modifyName != null and modifyName != ''"> and modify__name like concat('%', #{modifyName}, '%')</if>
<if test="trailerNum != null "> and trailer_num = #{trailerNum}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>

@ -26,16 +26,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBaseDeviceVo">
select id, tyre_fac_code, company_code, internet_things_no, sim_code, device_type, state, active_time, last_run_time, is_delete, create_time, create_id, create_by, create_name, modify_time, modify_id, modify_by, modify__name from base_device
select id, tyre_fac_code, company_code, internet_things_no, sim_code, device_type, state, active_time, last_run_time, is_delete, bd.create_time, create_id, bd.create_by, bd.create_name, bd.modify_time, bd.modify_id, bd.modify_by, bd.modify__name from base_device bd
</sql>
<select id="selectBaseDeviceList" parameterType="BaseDevice" resultMap="BaseDeviceResult">
<include refid="selectBaseDeviceVo"/>
left join sys_user_role ur on bd.create_by = ur.user_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
<if test="tyreFacCode != null and tyreFacCode != ''"> and tyre_fac_code = #{tyreFacCode}</if>
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
<if test="internetThingsNo != null and internetThingsNo != ''"> and internet_things_no like concat('%', #{internetThingsNo}, '%') </if>
<if test="simCode != null and simCode != ''"> and sim_code = #{simCode}</if>
<if test="simCode != null and simCode != ''"> and sim_code like concat('%', #{simCode}, '%')</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="state != null "> and state = #{state}</if>
<if test="activeTime != null "> and active_time = #{activeTime}</if>
@ -47,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="modifyId != null and modifyId != ''"> and modify_id = #{modifyId}</if>
<if test="modifyBy != null and modifyBy != ''"> and modify_by = #{modifyBy}</if>
<if test="modifyName != null and modifyName != ''"> and modify__name like concat('%', #{modifyName}, '%')</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
@ -58,6 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBaseDeviceVo"/>
where internet_things_no = #{internetThingsNo}
</select>
<select id="checkBaseDeviceUnique" resultType="com.ruoyi.basetyre.domain.BaseDevice">
select id, internet_things_no as internetThingsNo
from base_device
where internet_things_no = #{internetThingsNo}
</select>
<insert id="insertBaseDevice" parameterType="BaseDevice">
insert into base_device

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basetyre.mapper.BaseElectronicFenceMapper">
<resultMap type="BaseElectronicFence" id="BaseElectronicFenceResult">
<result property="id" column="id" />
<result property="carId" column="car_id" />
<result property="latitude" column="latitude" />
<result property="longitude" column="longitude" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createName" column="create_name" />
<result property="modifyTime" column="modify_time" />
<result property="modifyBy" column="modify_by" />
<result property="remark" column="remark" />
<result property="other1" column="other1" />
<result property="other2" column="other2" />
</resultMap>
<sql id="selectBaseElectronicFenceVo">
select id, car_id, latitude, longitude, create_time, create_by, create_name, modify_time, modify_by, remark, other1, other2 from base_electronic_fence
</sql>
<select id="selectBaseElectronicFenceList" parameterType="BaseElectronicFence" resultMap="BaseElectronicFenceResult">
<include refid="selectBaseElectronicFenceVo"/>
<where>
<if test="carId != null and carId != ''"> and car_id = #{carId}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="createName != null and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
<if test="modifyBy != null and modifyBy != ''"> and modify_by = #{modifyBy}</if>
<if test="other1 != null and other1 != ''"> and other1 = #{other1}</if>
<if test="other2 != null and other2 != ''"> and other2 = #{other2}</if>
</where>
</select>
<select id="selectBaseElectronicFenceById" parameterType="String" resultMap="BaseElectronicFenceResult">
<include refid="selectBaseElectronicFenceVo"/>
where id = #{id}
</select>
<insert id="insertBaseElectronicFence" parameterType="BaseElectronicFence">
insert into base_electronic_fence
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="carId != null">car_id,</if>
<if test="latitude != null">latitude,</if>
<if test="longitude != null">longitude,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createName != null">create_name,</if>
<if test="modifyTime != null">modify_time,</if>
<if test="modifyBy != null">modify_by,</if>
<if test="remark != null">remark,</if>
<if test="other1 != null">other1,</if>
<if test="other2 != null">other2,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="carId != null">#{carId},</if>
<if test="latitude != null">#{latitude},</if>
<if test="longitude != null">#{longitude},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createName != null">#{createName},</if>
<if test="modifyTime != null">#{modifyTime},</if>
<if test="modifyBy != null">#{modifyBy},</if>
<if test="remark != null">#{remark},</if>
<if test="other1 != null">#{other1},</if>
<if test="other2 != null">#{other2},</if>
</trim>
</insert>
<update id="updateBaseElectronicFence" parameterType="BaseElectronicFence">
update base_electronic_fence
<trim prefix="SET" suffixOverrides=",">
<if test="carId != null">car_id = #{carId},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createName != null">create_name = #{createName},</if>
<if test="modifyTime != null">modify_time = #{modifyTime},</if>
<if test="modifyBy != null">modify_by = #{modifyBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="other1 != null">other1 = #{other1},</if>
<if test="other2 != null">other2 = #{other2},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseElectronicFenceById" parameterType="String">
delete from base_electronic_fence where id = #{id}
</delete>
<delete id="deleteBaseElectronicFenceByIds" parameterType="String">
delete from base_electronic_fence where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectBaseFireSetRecordById" parameterType="Long" resultMap="BaseFireSetRecordResult">
<select id="selectBaseFireSetRecordById" parameterType="String" resultMap="BaseFireSetRecordResult">
SELECT top 1 * FROM [dbo].[base_fire_set_record]
where car_id = #{carId}
ORDER BY create_time desc

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
bthr.car_online_mileage AS course,
bthr.texture_depth AS textureDepth,
bthr.create_time AS TIME
bthr.create_time AS createTime
FROM
base_tyre_historical_records bthr
LEFT JOIN base_tyre bt ON bt.id= bthr.tyre_id
@ -83,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="carLicense != null">car_license,</if>
<if test="type != null">type,</if>
<if test="textureDepth != null">texture_depth,</if>
<if test="carOnlineMileage != null">car_online_mileage,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -94,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="carLicense != null">#{carLicense},</if>
<if test="type != null">#{type},</if>
<if test="textureDepth != null">#{textureDepth},</if>
<if test="carOnlineMileage != null">#{textureDepth},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>

@ -54,14 +54,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="modifyBy" column="modify_by" />
<result property="modifyName" column="modify__name" />
<result property="remark" column="remark" />
<result property="companyCode" column="company_code" />
</resultMap>
<sql id="selectBaseTyreVo">
select 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, modify_time, modify_id, modify_by, modify__name, remark from base_tyre
select 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, bt.create_time, bt.create_id, bt.create_by, bt.create_name, bt.modify_time, bt.modify_id, bt.modify_by, bt.modify__name, bt.remark,company_code from base_tyre bt
</sql>
<select id="selectBaseTyreList" parameterType="BaseTyre" resultMap="BaseTyreResult">
<include refid="selectBaseTyreVo"/>
left join sys_user u on u.user_name=bt.company_code
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where>
<if test="tyreFactory != null and tyreFactory != ''"> and tyre_factory like concat('%', #{tyreFactory}, '%') </if>
<if test="outerTireNumber != null and outerTireNumber != ''"> and outer_tire_number like concat('%', #{outerTireNumber}, '%')</if>
@ -109,6 +113,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="modifyId != null and modifyId != ''"> and modify_id = #{modifyId}</if>
<if test="modifyBy != null and modifyBy != ''"> and modify_by = #{modifyBy}</if>
<if test="modifyName != null and modifyName != ''"> and modify__name like concat('%', #{modifyName}, '%')</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>

@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dLIsencryption != null "> and d_l_isencryption = #{dLIsencryption}</if>
<if test="speed != null "> and speed = #{speed}</if>
<if test="course != null "> and course = #{course}</if>
<if test="createTime != null "> and createtime = #{createTime}</if>
<if test="params.beginTime != null and params.endTime != null"> and createtime BETWEEN #{params.beginTime} AND #{params.endTime}</if>
<if test="gpsIntensity != null "> and gps_intensity = #{gpsIntensity}</if>
<if test="gpsSatellites != null "> and gps_satellites = #{gpsSatellites}</if>
<if test="gpsMileage != null "> and gps_mileage = #{gpsMileage}</if>

@ -154,6 +154,11 @@
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
</dependencies>

@ -1,9 +1,10 @@
package com.ruoyi.framework.websocket;
package com.ruoyi.common.websocket;
import java.util.concurrent.Semaphore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Semaphore;
/**
*
*

@ -0,0 +1,28 @@
package com.ruoyi.common.websocket;
import javax.websocket.Session;
public class WebSocketClient {
// 与某个客户端的连接会话,需要通过它来给客户端发送数据
private Session session;
//连接的uri
private String uri;
public Session getSession() {
return session;
}
public void setSession(Session session) {
this.session = session;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
}

@ -0,0 +1,20 @@
package com.ruoyi.common.websocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* websocket
*
* @author ruoyi
*/
@Configuration
public class WebSocketConfig
{
@Bean
public ServerEndpointExporter serverEndpointExporter()
{
return new ServerEndpointExporter();
}
}

@ -1,16 +1,20 @@
package com.ruoyi.framework.websocket;
package com.ruoyi.common.websocket;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import io.netty.buffer.ByteBuf;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -21,7 +25,7 @@ import org.springframework.stereotype.Component;
* @author ruoyi
*/
@Component
@ServerEndpoint("/websocket/message")
@ServerEndpoint("/websocket/message/{userName}")
public class WebSocketServer
{
/**
@ -35,13 +39,22 @@ public class WebSocketServer
public static int socketMaxOnlineCount = 100;
private static Semaphore socketSemaphore = new Semaphore(socketMaxOnlineCount);
private static ConcurrentHashMap<String, WebSocketClient> webSocketMap = new ConcurrentHashMap<>();
/**与某个客户端的连接会话,需要通过它来给客户端发送数据*/
private Session session;
/**接收userName*/
private String userName="";
/**
*
*/
@OnOpen
public void onOpen(Session session) throws Exception
public void onOpen(@PathParam("userName") String userName, Session session) throws Exception
{
//获取登陆用户信息
//USER_SESSIONS.put(loginUser.getUserId().toString(),session);
// this.session = session;
// websockets.put(id, this); //将ID作为key当前的对象作为Value
boolean semaphoreFlag = false;
// 尝试获取信号量
semaphoreFlag = SemaphoreUtils.tryAcquire(socketSemaphore);
@ -56,9 +69,17 @@ public class WebSocketServer
{
// 添加用户
WebSocketUsers.put(session.getId(), session);
this.session = session;
this.userName= userName;
WebSocketClient client = new WebSocketClient();
client.setSession(session);
client.setUri(session.getRequestURI().toString());
webSocketMap.put(userName, client);
LOGGER.info("\n 建立连接 - {}", session);
LOGGER.info("\n 当前人数 - {}", WebSocketUsers.getUsers().size());
WebSocketUsers.sendMessageToUserByText(session, "连接成功");
WebSocketUsers.sendMessageToUserByText(session, "连接成功session:"+session);
}
}
@ -104,5 +125,21 @@ public class WebSocketServer
String msg = message.replace("你", "我").replace("吗", "");
WebSocketUsers.sendMessageToUserByText(session, msg);
}
/**
*
* @param userName
* @param message
*/
public static void sendMessage(String userName,String message){
try {
WebSocketClient webSocketClient = webSocketMap.get(userName);
if(webSocketClient!=null){
webSocketClient.getSession().getBasicRemote().sendText(message);
}
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
}

@ -1,13 +1,15 @@
package com.ruoyi.framework.websocket;
package com.ruoyi.common.websocket;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.websocket.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.socket.client.WebSocketClient;
/**
* websocket
@ -116,7 +118,7 @@ public class WebSocketUsers
/**
*
*
* @param userName
* @param session
* @param message
*/
public static void sendMessageToUserByText(Session session, String message)
@ -137,4 +139,17 @@ public class WebSocketUsers
LOGGER.info("\n[你已离线]");
}
}
// public void sendMessage(String message, String userId){
// try {
// if (USERS.get(userId)!=null){
//
// }
//
// }catch (Exception e){
// e.printStackTrace();
// throw new RuntimeException(e.getMessage());
// }
// }
}

@ -60,10 +60,7 @@
<artifactId>ruoyi-system</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-basetyre</artifactId>

@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage","/system/language/change","/websocket/**").permitAll()
.antMatchers("/login", "/register", "/captchaImage","/system/language/change","/websocket/**","/basetyre/tyre/TyreWarring").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

@ -1,6 +1,8 @@
package com.ruoyi.framework.web.service;
import javax.annotation.Resource;
import javax.websocket.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
@ -29,6 +31,9 @@ import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*
@ -54,6 +59,7 @@ public class SysLoginService
@Autowired
private MessageSource messageSource;
/**
*
*

@ -1,39 +0,0 @@
package com.ruoyi.framework.websocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* websocket
*
* @author ruoyi
*/
@Configuration
public class WebSocketConfig
{
@Bean
public ServerEndpointExporter serverEndpointExporter()
{
return new ServerEndpointExporter();
}
// @Bean
// public EchoSocketServer echoSocketServer(){
// return new EchoSocketServer(8691);
// }
}

@ -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'
VITE_APP_BASE_API = 'https://ticptest.tercelo.com/dev-api'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

@ -7,4 +7,12 @@ export function getTempdata(query) {
method: 'get',
params: query
})
}
// 首页看板
export function getIndexdata(query) {
return request({
url: '/report/indexreport',
method: 'post',
params: query
})
}

@ -45,6 +45,7 @@
</li>
</ul>
</div>
</template>
<script setup>
@ -71,6 +72,8 @@ const router = useRouter();
const visitedViews = computed(() => useTagsViewStore().visitedViews);
const routes = computed(() => usePermissionStore().routes);
const theme = computed(() => useSettingsStore().theme);
const url = 'ws://127.0.0.1:8080/websocket/message'
watch(route, () => {
addTags()
@ -86,8 +89,10 @@ watch(visible, (value) => {
onMounted(() => {
initTags()
addTags()
})
function isActive(r) {
return r.path === route.path
}

@ -140,8 +140,8 @@
</el-table-column>
<el-table-column :label="t('baseDevice.baseDevice.activeTime')" align="center" prop="activeTime"
width="150"/>
<el-table-column :label="t('baseDevice.baseDevice.lastRunTime')" align="center" prop="lastRunTime"
width="150"/>
<!-- <el-table-column :label="t('baseDevice.baseDevice.lastRunTime')" align="center" prop="lastRunTime"-->
<!-- width="150"/>-->
<el-table-column :label="t('common.createTime')" align="center" prop="createTime" width="160"/>
<el-table-column :label="t('common.createBy')" align="center" prop="createName"/>
</el-table>
@ -166,6 +166,11 @@
v-model="form.internetThingsNo"
:placeholder="t('common.pleaseEnter') + '物联卡卡号'"/>
</el-form-item>
<el-form-item label="手机卡号" prop="simCode">
<el-input
v-model="form.simCode"
:placeholder="t('common.pleaseEnter') + '手机卡号'"/>
</el-form-item>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" :placeholder="t('common.PleaseSelect')" class="m-2">
<el-option

@ -5,10 +5,10 @@
<div id="carCharts" style="height:150px;width:150px;display: inline-block;margin-top: 20px"/>
<div
style="width: 150px;display: inline-block;vertical-align: top;color:#fff;text-align: center;margin-top: 20px">
<div style="color: #3A71A8">正常</div>
<div style="color: #3A71A8">车辆总</div>
<div style="font-size: 24px">222<span style="vertical-align: top;font-size: 12px;color:#1ab394">66.6%</span>
</div>
<div style="color: #3A71A8">故障数</div>
<div style="color: #3A71A8">已绑定GPS</div>
<div style="font-size: 24px">111<span style="vertical-align: top;font-size: 12px;color:#1ab394">33.3%</span>
</div>
</div>
@ -16,17 +16,17 @@
<div id="tyreCharts" style="height:150px;width:150px;display: inline-block;margin-top: 20px"/>
<div
style="width: 150px;display: inline-block;vertical-align: top;color:#fff;text-align: center;margin-top: 20px">
<div style="color: #3A71A8">正常</div>
<div style="color: #3A71A8">轮胎</div>
<div style="font-size: 24px">222<span style="vertical-align: top;font-size: 12px;color:#1ab394">66.6%</span>
</div>
<div style="color: #3A71A8">故障</div>
<div style="color: #3A71A8">已安装传感器</div>
<div style="font-size: 24px">111<span style="vertical-align: top;font-size: 12px;color:#1ab394">33.3%</span>
</div>
</div>
<div
style="width: 80%;border: 1px solid #ccc;padding: 14px ;text-align: center;margin-left: 10%;color:#fff;margin-top: 100px">
<div style="font-size: 24px"> 101.101%</div>
<div style="font-size: 12px">描述文字</div>
<div style="font-size: 24px">车辆总里程</div>
<div style="font-size: 20px;color: greenyellow">156325公里</div>
</div>
<div style="width: 100%;color: #fff;margin-top: 40px;font-size: 12px">
<div style="width: 33%;float: left;text-align: center">
@ -132,10 +132,16 @@ import * as echarts from 'echarts';
// require('echarts/theme/macarons') // echarts theme
// import resize from './mixins/resize'
import chinaMap from './china.json'
import {getIndexdata} from "@/api/report/report";
const animationDuration = 6000
const username=null
const dataInfo = ref({
carTotal: '',
carBindGps: '',
tyreTotal: '',
tyreBindSensor: ''
})
export default {
// mixins: [resize],
expose: ['setData'],
@ -298,6 +304,7 @@ export default {
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
this.initCarChart()
@ -321,6 +328,12 @@ export default {
this.initChart()
},
initChart() {
getIndexdata().then(response => {
console.log(response)
}).finally(() => {
});
echarts.registerMap('china', chinaMap);
this.chart = echarts.init(document.getElementById('charts'), 'macarons')
this.chart.showLoading();
@ -624,7 +637,7 @@ export default {
}
const getWebsocket = () => {
let websocket = new WebSocket("ws://10.11.41.249:8080/websocket/message")
let websocket = new WebSocket("ws://10.11.41.249:8080/websocket/message/admin_ny")
websocket.onopen = function (event) {
console.log("服务已连接")
};

@ -102,6 +102,7 @@ import {getCurrentInstance} from "vue";
import {useI18n} from 'vue-i18n';
const {t} = useI18n();
const lang = (e) => {
Cookies.set('language', e)
cutLang().finally(() => {
@ -185,6 +186,9 @@ function getCookie() {
};
}
getCode();
getCookie();
</script>

@ -141,6 +141,7 @@
<el-table-column label="最新花纹深度(mm)" align="center" prop="currentTextureDepth" width="170"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
<el-table-column label="创建者" align="center" prop="createName" width="170"/>
<el-table-column label="使用企业" align="center" prop="companyCode" width="170"/>
<el-table-column :label="t('option.option')" align="center" class-name="small-padding fixed-width" fixed="right"
width="160">
<template #default="scope">

Loading…
Cancel
Save