server_2024_4_2_suzejing #8

Merged
xiaoSu merged 2 commits from server_2024_4_2_suzejing into master 2024-04-08 10:08:51 +08:00
45 changed files with 948 additions and 156 deletions

View File

@ -250,6 +250,11 @@
<version>${mqttv3.version}</version>
</dependency>
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-business</artifactId>
<version>${zhilian.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -19,6 +19,7 @@
<module>zhilian-common-datasource</module>
<module>zhilian-common-system</module>
<module>zhilian-common-resolver</module>
<module>zhilian-common-business</module>
</modules>
<artifactId>zhilian-common</artifactId>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>zhilian-common-business</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- zhilian Common Core-->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -12,6 +12,8 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
@Data
@SuperBuilder
@NoArgsConstructor
@ -50,6 +52,6 @@ public class Fence extends BaseEntity {
@Excel(name = "电子围栏经纬度信息")
@TableField("fence_message")
private String fenceMessage;
@TableField(exist = false)
List<Markers> markersList;
}

View File

@ -0,0 +1,35 @@
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import java.util.List;
@Data
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("business_markers")
public class Markers extends BaseEntity {
@TableId(value = "markers_id", type = IdType.AUTO)
@Excel(name = "标识编号")
private Long markersId;
@TableField("markers_name")
@Excel(name = "标识名称")
private String markersName;
@TableField(exist = false)
List<Long> fenceIds;
}

View File

@ -0,0 +1,71 @@
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* business_vehicle
*/
@Data
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("business_vehicle")
public class Vehicle extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@Excel(name = "车辆ID",cellType = Excel.ColumnType.NUMERIC)
@TableId(value = "vehicle_id",type = IdType.AUTO)
private Long vehicleId;
/**
* VIN
*/
@TableField("vehicle_vin")
private String vehicleVIN;
/**
*
*/
private Long vehicleTypeId;
@TableField(exist = false)
private Long vehicleTypeName;
/**
*
*/
private String vehicleMotor;
/**
*
*/
private String vehicleBattery;
/**
* ID
*/
private String motorId;
/**
* ID
*/
private String batteryId;
/**
*
*/
private Long vehicleState;
@TableField(exist = false)
private List<Long> markersIds;
}

View File

@ -0,0 +1,29 @@
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhilian.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ToString
@TableName(value = "business_vehicle_type")
public class VehicleType {
@TableId(value = "vehicle_type_id", type = IdType.AUTO)
@Excel(name = "车型ID")
private Long vehicleTypeId;
@Excel(name = "车型名称")
@TableField(value = "vehicle_type_name")
private String vehicleTypeName;
}

View File

@ -0,0 +1,34 @@
package com.zhilian.business.domain.middle;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
@TableName("business_markers_fence")
public class MarkersFence {
/**
*
*/
@TableId(value = "markers_id",type = IdType.INPUT)
private Long markerId;
@TableField(value = "fence_id",insertStrategy = FieldStrategy.IGNORED)
private Long fenceId;
public Long getMarkerId() {
return markerId;
}
public void setMarkerId(Long markerId) {
this.markerId = markerId;
}
public Long getFenceId() {
return fenceId;
}
public void setFenceId(Long fenceId) {
this.fenceId = fenceId;
}
}

View File

@ -0,0 +1,38 @@
package com.zhilian.business.domain.middle;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
@TableName("business_vehicle_markers")
public class VehicleMarkers {
/**
*
*/
@TableId(value = "vehicle_id",type = IdType.INPUT)
private Long vehicleId;
/**
*
*/
@TableField(value = "markers_id",insertStrategy = FieldStrategy.IGNORED)
private Long markersId;
public Long getVehicleId() {
return vehicleId;
}
public void setVehicleId(Long vehicleId) {
this.vehicleId = vehicleId;
}
public Long getMarkersId() {
return markersId;
}
public void setMarkersId(Long markersId) {
this.markersId = markersId;
}
}

View File

@ -1,4 +1,4 @@
package com.zhilian.business.domain;
package com.zhilian.business.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -33,11 +33,4 @@ public class FenceVo {
private Long fenceState;
/**
*
*/
private Integer pageNum=1;
private Integer pageSize=5;
}

View File

@ -0,0 +1,8 @@
package com.zhilian.business.domain.vo;
import lombok.Data;
@Data
public class MarkersVo {
}

View File

@ -0,0 +1,37 @@
package com.zhilian.business.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zhilian.common.core.annotation.Excel;
import lombok.Data;
@Data
public class VehicleVo {
/**
* VIN
*/
private String vehicleVIN;
/**
*
*/
private Long vehicleTypeId;
/**
*
*/
private Long fenceId;
/**
*
*/
private String motorBusiness;
/**
*
*/
private String batteryBusiness;
/**
* ID
*/
private String motorID;
/**
* ID
*/
private String batteryID;
}

View File

@ -0,0 +1,7 @@
package com.zhilian.business.remote;
import org.springframework.stereotype.Component;
@Component
public interface RemoteFenceService {
}

View File

@ -0,0 +1,8 @@
package com.zhilian.business.remote.factory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
//@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public class RemoteFenceFallbackFactory {
}

View File

@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
*

View File

@ -73,6 +73,12 @@
<artifactId>zhilian-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-business</artifactId>
</dependency>
<!-- zhilian Common Swagger -->
<dependency>
<groupId>com.zhilian</groupId>
@ -106,4 +112,4 @@
</plugins>
</build>
</project>
</project>

View File

@ -1,16 +1,17 @@
package com.zhilian.business.controller;
import com.github.pagehelper.PageInfo;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.business.domain.Fence;
import com.zhilian.business.domain.FenceVo;
import com.zhilian.business.service.FenceService;
import com.zhilian.common.core.web.page.TableDataInfo;
import com.zhilian.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* @ClassName FenceController
* @Description
@ -27,8 +28,10 @@ public class FenceController extends BaseController {
* TODO:
*/
@PostMapping("/list")
public Result<PageInfo<Fence>> fenceList(@RequestBody FenceVo fenceVo) {
return success(fenceService.fenceList(fenceVo));
public Result<TableDataInfo<Fence>> fenceList(@RequestBody Fence fence) {
startPage();
List<Fence> result = fenceService.fenceList(fence);
return getDataTable(result);
}
/**
@ -38,24 +41,27 @@ public class FenceController extends BaseController {
*/
@PostMapping("/fenceAdd")
public Result fenceAdd(@RequestBody Fence fence) {
boolean i = fenceService.save(fence);
return toAjax(i);
fence.setUpdateBy(SecurityUtils.getUsername());
fence.setUpdateTime(new Date());
return toAjax(fenceService.save(fence));
}
// @PostMapping("insertFence")
// public Result insertFence(@RequestBody Fence fence) {
// Result result = fenceService.insertFence(fence);
// return Result.success();
// }
/**
*
*/
// @RequiresPermissions("system:config:fenceAdd")
@PostMapping("/fenceUpdate")
public Result fenceUpdate(@RequestBody Fence fence) {
boolean i = fenceService.updateById(fence);
return toAjax(i);
fence.setUpdateBy(SecurityUtils.getUsername());
fence.setUpdateTime(new Date());
return toAjax(fenceService.updateById(fence));
}
@PostMapping("/fenceUpdateMap")
public Result fenceUpdateMap(@RequestBody Fence fence) {
fence.setUpdateBy(SecurityUtils.getUsername());
fence.setUpdateTime(new Date());
return toAjax(fenceService.updateById(fence));
}
/**
@ -65,8 +71,8 @@ public class FenceController extends BaseController {
*/
@PostMapping("/fenceDelete/{fenceId}")
public Result fenceDelete(@PathVariable String fenceId) {
boolean i = fenceService.removeById(fenceId);
return toAjax(i);
return toAjax(fenceService.removeById(fenceId));
}
}

View File

@ -0,0 +1,72 @@
package com.zhilian.business.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.service.MarkersFenceService;
import com.zhilian.business.service.MarkersService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/markers")
public class MarkersController extends BaseController {
@Autowired
private MarkersService markersService;
@Autowired
private MarkersFenceService markersFenceService;
/**
*
* @param markers
* @return
*/
@PostMapping("list")
public Result<TableDataInfo<Markers>> list(@RequestBody Markers markers) {
startPage();
List<Markers> result = markersService.selectMarkersList(markers);
return getDataTable(result);
}
@GetMapping("markersVehicle")
public Result<List<Markers>> markersVehicle() {
List<Markers> listMarkers = markersService.listMarkers();
return Result.success(listMarkers);
}
@PostMapping("insert")
public Result insert(@RequestBody Markers markers){
return toAjax(markersService.save(markers));
}
@PostMapping("update")
public Result update(@RequestBody Markers markers) {
return toAjax(markersService.updateById(markers));
}
@PostMapping("delete/{markersId}")
public Result delete(@PathVariable Long markersId) {
markersFenceList(markersId).forEach(markersFence -> {
markersFenceService.removeById(markersId);
});
return toAjax(markersService.removeById(markersId));
}
@PostMapping("insertMarkersFence")
public Result insertMarkersFenceMarkers(@RequestBody MarkersFence markersFence){
return toAjax(markersFenceService.save(markersFence));
}
@PostMapping("markersFenceList/{markersId}")
public List<MarkersFence> markersFenceList(@PathVariable Long markersId){
LambdaQueryWrapper<MarkersFence> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MarkersFence::getMarkerId, markersId);
return markersFenceService.list(queryWrapper);
}
}

View File

@ -0,0 +1,24 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.service.MarkersFenceService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
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 java.util.List;
@RestController
@RequestMapping("/markersFence")
public class MarkersFenceController extends BaseController {
@Autowired
private MarkersFenceService markersFenceService;
@PostMapping("/list")
public Result<List<MarkersFence>> markersFenceList() {
return Result.success(markersFenceService.list());
}
}

View File

@ -0,0 +1,124 @@
package com.zhilian.business.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.service.MarkersService;
import com.zhilian.business.service.VehicleMarkersService;
import com.zhilian.business.service.VehicleService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.common.core.web.page.TableDataInfo;
import com.zhilian.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/vehicle")
public class VehicleController extends BaseController {
@Autowired
private VehicleService vehicleService;
@Autowired
private VehicleMarkersService vehicleMarkersService;
@Autowired
private MarkersService markersService;
/**
*
* @param vehicle
* @return
*/
@PostMapping("/list")
public Result<TableDataInfo<Vehicle>> list(@RequestBody Vehicle vehicle) {
startPage();
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
return getDataTable(list);
}
/**
*
* @param vehicle
* @return
*/
@PostMapping("/vehicleInsert")
public Result vehicleInsert(@RequestBody Vehicle vehicle){
vehicle.setCreateBy(SecurityUtils.getUsername());
vehicle.setCreateTime(new Date());
return toAjax(vehicleService.save(vehicle));
}
/**
*
* @param vehicle
* @return
*/
@PostMapping("/vehicleUpdate")
public Result vehicleUpdate(@RequestBody Vehicle vehicle){
vehicle.setUpdateBy(SecurityUtils.getUsername());
vehicle.setUpdateTime(new Date());
//删除中间表全部关联数据
vehicleMarkersService.removeAllVehicle(vehicle);
//修改原表数据
boolean update =vehicleService.updateById(vehicle);
//重新添加中间表数据
vehicleMarkersService.insert(vehicle);
return toAjax(update);
}
/**
* ID
* @param vehicleId
* @return
*/
@PostMapping("/getVehicleMarkers/{vehicleId}")
public List<VehicleMarkers> getVehicleMarkers(@PathVariable Long vehicleId){
LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
return vehicleMarkersService.list(queryWrapper);
}
// @PostMapping("/getMarkers/{vehicleId}")
// public List<Markers> getMarkers(@PathVariable Long vehicleId){
// LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
// List<VehicleMarkers> list = vehicleMarkersService.list(queryWrapper);
// list.forEach(vehicleMarkers -> {
// Markers markers = markersService.getById(vehicleMarkers.getMarkersId());
// });
// return null;
// }
/**
*
* @param vehicleId
* @return
*/
@PostMapping("/vehicleDelete/{vehicleId}")
public Result vehicleDelete(@PathVariable Long vehicleId){
getVehicleMarkers(vehicleId).forEach(vehicleMarkers -> {
vehicleMarkersService.removeById(vehicleId);
});
return toAjax(vehicleService.removeById(vehicleId));
}
/**
*
* @param vehicle
* @return
*/
@PostMapping("/vehicleInsertMarkers")
public Result vehicleInsertMarkers(@RequestBody Vehicle vehicle){
boolean insert = vehicleMarkersService.insert(vehicle);
return toAjax(insert);
}
}

View File

@ -0,0 +1,24 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.service.VehicleMarkersService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
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 java.util.List;
@RestController
@RequestMapping("/vehicleMarkers")
public class VehicleMarkersController extends BaseController {
@Autowired
private VehicleMarkersService vehicleMarkersService;
@PostMapping("/list")
public Result<List<VehicleMarkers>> vehicleMarkersList() {
return Result.success(vehicleMarkersService.list());
}
}

View File

@ -0,0 +1,25 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.VehicleType;
import com.zhilian.business.service.VehicleTypeService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("vehicleType")
public class VehicleTypeController extends BaseController {
@Autowired
private VehicleTypeService vehicleTypeService;
@GetMapping("list")
public Result<List<VehicleType>> list(){
List<VehicleType> list = vehicleTypeService.listVehicleType();
return Result.success(list);
}
}

View File

@ -1,31 +0,0 @@
package com.zhilian.business.domain.request;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class FenceRequest extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String fenceName;
/**
*
*/
private Long fenceTypeId;
/**
*
*/
private Long fenceState;
}

View File

@ -2,7 +2,7 @@ package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Fence;
import com.zhilian.business.domain.FenceVo;
import com.zhilian.business.domain.vo.FenceVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -0,0 +1,11 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.middle.MarkersFence;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface MarkersFenceMapper extends BaseMapper<MarkersFence> {
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Markers;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface MarkersMapper extends BaseMapper<Markers> {
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Vehicle;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface VehicleMapper extends BaseMapper<Vehicle> {
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface VehicleMarkersMapper extends BaseMapper<VehicleMarkers> {
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.VehicleType;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface VehicleTypeMapper extends BaseMapper<VehicleType> {
}

View File

@ -1,14 +1,10 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.zhilian.business.domain.Fence;
import com.zhilian.business.domain.FenceVo;
import com.zhilian.common.core.domain.Result;
import java.util.List;
public interface FenceService extends IService<Fence> {
PageInfo<Fence> fenceList(FenceVo fenceVo);
// Result insertFence(Fence fence);
List<Fence> fenceList(Fence fence);
}

View File

@ -0,0 +1,8 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.middle.MarkersFence;
public interface MarkersFenceService extends IService<MarkersFence> {
// List<MarkersFence> selectFenceByIdAndMarkersBuyId(List<MarkersFence> list, List<Fence> list1, List<Markers> list2,MarkersFence markersFence);
}

View File

@ -0,0 +1,13 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Markers;
import java.util.List;
public interface MarkersService extends IService<Markers> {
List<Markers> selectMarkersList(Markers markers);
List<Markers> listMarkers();
}

View File

@ -0,0 +1,14 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.springframework.stereotype.Service;
@Service
public interface VehicleMarkersService extends IService<VehicleMarkers> {
boolean insert(Vehicle vehicle);
void removeAllVehicle(Vehicle vehicle);
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Vehicle;
import java.util.List;
public interface VehicleService extends IService<Vehicle> {
List<Vehicle> selectVehicleList(Vehicle vehicle);
}

View File

@ -0,0 +1,13 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.VehicleType;
import java.util.List;
public interface VehicleTypeService extends IService<VehicleType> {
List<VehicleType> listVehicleType();
}

View File

@ -1,38 +1,40 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhilian.business.domain.Fence;
import com.zhilian.business.domain.FenceVo;
import com.zhilian.business.mapper.FenceMapper;
import com.zhilian.business.service.FenceService;
import com.zhilian.common.core.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import com.zhilian.common.core.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
@Autowired
private FenceMapper fenceMapper;
@Override
public PageInfo<Fence> fenceList(FenceVo fenceVo) {
public List<Fence> fenceList(Fence fence) {
if (fence.getFenceName() == null && fence.getFenceTypeId() == null && fence.getFenceState() == null) {
return this.list();
}
PageHelper.startPage(fenceVo.getPageNum(),fenceVo.getPageSize());
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
List<Fence> list=fenceMapper.fenceList(fenceVo);
// 模糊条件 - 电子围栏名称
if (StringUtils.isNotEmpty(fence.getFenceName())) {
queryWrapper.like(Fence::getFenceName, fence.getFenceName());
}
PageInfo info = new PageInfo(list);
// 精确查询 - 查询类型
if (fence.getFenceTypeId() != null) {
queryWrapper.eq(Fence::getFenceTypeId, fence.getFenceTypeId());
}
return info;
// 模糊查询 - 状态
if (fence.getFenceState() != null) {
queryWrapper.eq(Fence::getFenceState, fence.getFenceState());
}
return this.list(queryWrapper);
}
// @Override
// public Result insertFence(Fence fence) {
// boolean save = this.save(fence);
// return Result.success(save);
// }
}

View File

@ -0,0 +1,16 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.mapper.MarkersFenceMapper;
import com.zhilian.business.service.MarkersFenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MarkersFenceServiceImpl extends ServiceImpl<MarkersFenceMapper, MarkersFence> implements MarkersFenceService {
@Autowired
private MarkersFenceMapper markersFenceMapper;
}

View File

@ -0,0 +1,43 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.mapper.MarkersMapper;
import com.zhilian.business.service.MarkersService;
import com.zhilian.common.core.utils.StringUtils;
import com.zhilian.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MarkersServiceImpl extends ServiceImpl<MarkersMapper, Markers> implements MarkersService {
@Autowired
RedisService service;
@Override
public List<Markers> selectMarkersList(Markers markers) {
LambdaQueryWrapper<Markers> queryWrapper = new LambdaQueryWrapper<>();
//模糊查询 查询标识名称
queryWrapper.like(StringUtils.isNotEmpty(markers.getMarkersName()), Markers::getMarkersName, markers.getMarkersName());
return this.list(queryWrapper);
}
/**
*
* @return
*/
@Override
public List<Markers> listMarkers() {
if(service.hasKey("markers")){
List<Markers> markers = service.getCacheList("markers");
return markers;
}
List<Markers> list = this.list();
service.setCacheList("markers",list);
return list;
}
}

View File

@ -0,0 +1,36 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.mapper.VehicleMarkersMapper;
import com.zhilian.business.service.VehicleMarkersService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class VehicleMarkersServiceImpl extends ServiceImpl<VehicleMarkersMapper, VehicleMarkers> implements VehicleMarkersService {
@Transactional(rollbackFor=Exception.class)
@Override
public boolean insert(Vehicle vehicle) {
vehicle.getMarkersIds().forEach(markerId -> {
VehicleMarkers vehicleMarkers = new VehicleMarkers();
vehicleMarkers.setVehicleId(vehicle.getVehicleId());
vehicleMarkers.setMarkersId(markerId);
this.save(vehicleMarkers);
});
return true;
}
@Override
public void removeAllVehicle(Vehicle vehicle) {
List<VehicleMarkers> list = this.list(new LambdaQueryWrapper<VehicleMarkers>().eq(VehicleMarkers::getVehicleId, vehicle.getVehicleId()));
list.forEach(item -> {
this.removeById(item.getVehicleId());
});
}
}

View File

@ -0,0 +1,63 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.mapper.VehicleMapper;
import com.zhilian.business.mapper.VehicleMarkersMapper;
import com.zhilian.business.service.VehicleService;
import com.zhilian.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
@Override
public List<Vehicle> selectVehicleList(Vehicle vehicle) {
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
//模糊条件 查询VIN
if (StringUtils.isNotEmpty(vehicle.getVehicleVIN())) {
queryWrapper.like(Vehicle::getVehicleVIN, vehicle.getVehicleVIN());
}
// 精确查询 - 查询类型
if (vehicle.getVehicleTypeId() != null) {
queryWrapper.eq(Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId());
}
//模糊查询 车辆电机厂商
if (StringUtils.isNotEmpty(vehicle.getMotorId())) {
queryWrapper.like(Vehicle::getMotorId, vehicle.getMotorId());
}
//模糊查询 车辆电池厂商
if (StringUtils.isNotEmpty(vehicle.getBatteryId())) {
queryWrapper.like(Vehicle::getBatteryId, vehicle.getBatteryId());
}
//模糊查询 车辆电机ID
if (StringUtils.isNotEmpty(vehicle.getVehicleMotor())) {
queryWrapper.like(Vehicle::getVehicleMotor, vehicle.getVehicleMotor());
}
//模糊查询 车辆电池ID
if (StringUtils.isNotEmpty(vehicle.getVehicleBattery())) {
queryWrapper.like(Vehicle::getVehicleBattery, vehicle.getVehicleBattery());
}
//精确查询 车辆状态
if (vehicle.getVehicleState() != null) {
queryWrapper.eq(Vehicle::getVehicleState, vehicle.getVehicleState());
}
// queryWrapper.like(StringUtils.isNotEmpty(vehicle.getVehicleVIN()), Vehicle::getVehicleVIN, vehicle.getVehicleVIN())
// .eq(vehicle.getVehicleTypeId() != null, Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId())
// .like(StringUtils.isNotEmpty(vehicle.getMotorID()), Vehicle::getMotorID, vehicle.getMotorID())
// .like(StringUtils.isNotEmpty(vehicle.getBatteryID()), Vehicle::getBatteryID, vehicle.getBatteryID())
// .like(StringUtils.isNotEmpty(vehicle.getMotorBusiness()), Vehicle::getMotorBusiness, vehicle.getMotorBusiness())
// .like(StringUtils.isNotEmpty(vehicle.getBatteryBusiness()), Vehicle::getBatteryBusiness, vehicle.getBatteryBusiness())
// .eq(vehicle.getVehicleState() != null, Vehicle::getVehicleState, vehicle.getVehicleState());
return this.list(queryWrapper);
}
}

View File

@ -0,0 +1,26 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.business.domain.VehicleType;
import com.zhilian.business.mapper.VehicleTypeMapper;
import com.zhilian.business.service.VehicleTypeService;
import com.zhilian.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class VehicleTypeServiceImpl extends ServiceImpl<VehicleTypeMapper, VehicleType> implements VehicleTypeService {
@Autowired
private RedisService redisService;
@Override
public List<VehicleType> listVehicleType() {
if(redisService.hasKey("vehicleType")){
List<VehicleType> vehicleType = redisService.getCacheList("vehicleType");
return vehicleType;
}
List<VehicleType> list = this.list();
redisService.setCacheList("vehicleType",list);
return this.list();
}
}

View File

@ -3,57 +3,5 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.business.mapper.FenceMapper">
<!-- <resultMap type="com.zhilian.business.domain.Fence" id="FenceResult">-->
<!-- <id property="fenceId" column="fence_id"/>-->
<!-- <result property="fenceName" column="fence_name"/>-->
<!-- <result property="fenceTypeId" column="fence_type_id"/>-->
<!-- <result property="fenceState" column="fence_state"/>-->
<!-- <result property="fenceMessage" column="fence_message"/>-->
<!-- <result property="createBy" column="create_by"/>-->
<!-- <result property="createTime" column="create_time"/>-->
<!-- <result property="updateBy" column="update_by"/>-->
<!-- <result property="updateTime" column="update_time"/>-->
<!-- <result property="remark" column="remark"/>-->
<!-- </resultMap>-->
<select id="fenceList" resultType="com.zhilian.business.domain.Fence">
select * from business_fence
<where>
<if test="fenceName!=null and fenceName!=''">
and fence_name like concat('%',#{fenceName},'%')
</if>
<if test="fenceTypeId!=null">
and fence_type_id=#{fenceTypeId}
</if>
<if test="fenceState!=null">
and fence_state=#{fenceState}
</if>
</where>
</select>
<!-- <sql id="selectFenceVo">-->
<!-- select fence_id,-->
<!-- fence_name,-->
<!-- fence_type_id,-->
<!-- fence_state,-->
<!-- fence_message,-->
<!-- create_by,-->
<!-- create_time,-->
<!-- update_by,-->
<!-- update_time,-->
<!-- remark-->
<!-- from business_fence-->
<!-- </sql>-->
<!-- <select id="fenceList" parameterType="com.zhilian.business.domain.Fence">-->
<!-- <include refid="selectFenceVo"/>-->
<!-- <where>-->
<!-- <if test="fenceName != null and fenceName != ''">-->
<!-- AND fence_name like concat('%', #{fenceName}, '%')-->
<!-- </if>-->
<!-- <if test="fenceTypeId != null">-->
<!-- AND fenceTypeId = #{fenceTypeId}-->
<!-- </if>-->
<!-- </where>-->
<!-- </select>-->
</mapper>

View File

@ -0,0 +1,7 @@
<?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.zhilian.business.mapper.VehicleMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?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.zhilian.business.mapper.VehicleMarkersMapper">
</mapper>

View File

@ -1,18 +0,0 @@
package com.zhilian.resolver;
import com.zhilian.common.security.annotation.EnableMyFeignClients;
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableCustomSwagger2
@EnableScheduling
@EnableMyFeignClients
@MapperScan({"com.zhilian.resolver.mapper", "com.zhilian.resolver.resolverReport"})
@SpringBootApplication
public class ZhiLianResolverApplication {
public static void main(String[] args) {
SpringApplication.run(ZhiLianResolverApplication.class, args);
}
}