feat:项目集成高德,实现多边形画图,打印出纬度
parent
0a69307158
commit
0b3d79d7d7
|
@ -22,8 +22,8 @@ public class DatabaseInitializer {
|
|||
public static void main(String[] args) {
|
||||
String postUrl="http://122.51.111.225:10006/webhook/%E6%96%B0%E5%BB%BA%E4%BC%81%E4%B8%9A%E6%95%B0%E6%8D%AE%E6%BA%90";
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("businessId",30+"sdftdfg");
|
||||
hashMap.put("mysqlPort",String.valueOf(3306+30));
|
||||
hashMap.put("businessId",40+"jhghj");
|
||||
hashMap.put("mysqlPort",String.valueOf(3301));
|
||||
String json = JSON.toJSONString(hashMap);
|
||||
// 3.创建连接与设置连接参数
|
||||
URL urlObj = null;
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.zhiLian.common.system.domain.SysFile;
|
|||
import com.zhiLian.common.system.remote.factory.RemoteFileFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -26,4 +28,8 @@ public interface RemoteFileService {
|
|||
*/
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public Result<SysFile> upload (@RequestPart(value = "file") MultipartFile file);
|
||||
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
|
|||
public Result<SysFile> upload (MultipartFile file) {
|
||||
return Result.error("上传文件失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getInfo(Long id) {
|
||||
return Result.error("获取失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class HelloWorldKafkaConsumer {
|
|||
|
||||
// 创建 properties 对象 配置 kafka消费者的配置信息
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "122.51.111.225:9092");
|
||||
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "111.229.102.61:9092");
|
||||
// 设置 键值的反序列化方式
|
||||
properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
||||
properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
||||
|
|
|
@ -67,7 +67,12 @@
|
|||
<groupId>com.zhiLian</groupId>
|
||||
<artifactId>zhiLian-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业依赖-->
|
||||
<dependency>
|
||||
<groupId>com.zhiLian</groupId>
|
||||
<artifactId>zhiLian-business</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- ZhiLian Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.zhiLian</groupId>
|
||||
|
@ -85,6 +90,12 @@
|
|||
<groupId>com.zhiLian</groupId>
|
||||
<artifactId>zhiLian-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zhiLian</groupId>
|
||||
<artifactId>zhiLian-data-service</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
package com.zhiLian.vehicle.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhiLian.common.core.domain.Result;
|
||||
import com.zhiLian.common.core.utils.poi.ExcelUtil;
|
||||
import com.zhiLian.common.core.web.controller.BaseController;
|
||||
import com.zhiLian.common.core.web.page.TableDataInfo;
|
||||
import com.zhiLian.common.log.annotation.Log;
|
||||
import com.zhiLian.common.log.enums.BusinessType;
|
||||
import com.zhiLian.common.security.annotation.RequiresPermissions;
|
||||
import com.zhiLian.vehicle.domain.Fence;
|
||||
import com.zhiLian.vehicle.service.IFenceService;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 围栏Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fence")
|
||||
public class FenceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IFenceService fenceService;
|
||||
|
||||
/**
|
||||
* 查询围栏列表
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Fence>> list(Fence fence)
|
||||
{
|
||||
startPage();
|
||||
List<Fence> list = fenceService.selectFenceList(fence);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出围栏列表
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:export")
|
||||
@Log(title = "围栏", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Fence fence)
|
||||
{
|
||||
List<Fence> list = fenceService.selectFenceList(fence);
|
||||
ExcelUtil<Fence> util = new ExcelUtil<Fence>(Fence.class);
|
||||
util.exportExcel(response, list, "围栏数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取围栏详细信息
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(fenceService.selectFenceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增围栏
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:add")
|
||||
@Log(title = "围栏", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Fence fence)
|
||||
{
|
||||
return toAjax(fenceService.insertFence(fence));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:edit")
|
||||
@Log(title = "围栏", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Fence fence)
|
||||
{
|
||||
return toAjax(fenceService.updateFence(fence));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除围栏
|
||||
*/
|
||||
// @RequiresPermissions("system:fence:remove")
|
||||
@Log(title = "围栏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(fenceService.deleteFenceByIds(ids));
|
||||
}
|
||||
}
|
|
@ -45,14 +45,14 @@ public class VehicleController extends BaseController
|
|||
* 导出车辆录入列表
|
||||
*/
|
||||
// @RequiresPermissions("system:vehicle:export")
|
||||
@Log(title = "车辆录入", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Vehicle vehicle)
|
||||
{
|
||||
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
||||
ExcelUtil<Vehicle> util = new ExcelUtil<Vehicle>(Vehicle.class);
|
||||
util.exportExcel(response, list, "车辆录入数据");
|
||||
}
|
||||
// @Log(title = "车辆录入", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(HttpServletResponse response, Vehicle vehicle)
|
||||
// {
|
||||
// List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
||||
// ExcelUtil<Vehicle> util = new ExcelUtil<Vehicle>(Vehicle.class);
|
||||
// util.exportExcel(response, list, "车辆录入数据");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取车辆录入详细信息
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
package com.zhiLian.vehicle.domain;
|
||||
|
||||
import com.zhiLian.common.core.annotation.Excel;
|
||||
import com.zhiLian.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 围栏对象 fence
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
public class Fence extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 围栏主键 */
|
||||
private Long id;
|
||||
|
||||
/** 围栏名称 */
|
||||
@Excel(name = "围栏名称")
|
||||
private String name;
|
||||
|
||||
/** 围栏经纬 */
|
||||
@Excel(name = "围栏经纬")
|
||||
private String fenceLongitudeLatitude;
|
||||
|
||||
/** 围栏备注 */
|
||||
@Excel(name = "围栏备注")
|
||||
private String fenceDescription;
|
||||
|
||||
/** 是否删除 0 不删除 1删除 */
|
||||
@Excel(name = "是否删除 0 不删除 1删除")
|
||||
private String isDelete;
|
||||
|
||||
/** 围栏状态 */
|
||||
@Excel(name = "围栏状态")
|
||||
private String fenceState;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setFenceLongitudeLatitude(String fenceLongitudeLatitude)
|
||||
{
|
||||
this.fenceLongitudeLatitude = fenceLongitudeLatitude;
|
||||
}
|
||||
|
||||
public String getFenceLongitudeLatitude()
|
||||
{
|
||||
return fenceLongitudeLatitude;
|
||||
}
|
||||
public void setFenceDescription(String fenceDescription)
|
||||
{
|
||||
this.fenceDescription = fenceDescription;
|
||||
}
|
||||
|
||||
public String getFenceDescription()
|
||||
{
|
||||
return fenceDescription;
|
||||
}
|
||||
public void setIsDelete(String isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public String getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
public void setFenceState(String fenceState)
|
||||
{
|
||||
this.fenceState = fenceState;
|
||||
}
|
||||
|
||||
public String getFenceState()
|
||||
{
|
||||
return fenceState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("fenceLongitudeLatitude", getFenceLongitudeLatitude())
|
||||
.append("fenceDescription", getFenceDescription())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("fenceState", getFenceState())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public class Vehicle extends BaseEntity
|
|||
|
||||
/** 车辆vin */
|
||||
@Excel(name = "车辆vin")
|
||||
private Long number;
|
||||
private String number;
|
||||
|
||||
/** 车辆类型 */
|
||||
@Excel(name = "车辆类型")
|
||||
|
@ -60,6 +60,6 @@ public class Vehicle extends BaseEntity
|
|||
|
||||
/** 企业ID */
|
||||
@Excel(name = "企业ID")
|
||||
private Long enterpriseId;
|
||||
private Long businessId;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.zhiLian.vehicle.domain.vo;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VehicleReq
|
||||
{
|
||||
|
||||
|
||||
/** 车辆主键 */
|
||||
private Long id;
|
||||
|
||||
/** 车辆vin */
|
||||
private String number;
|
||||
|
||||
/** 车辆类型 */
|
||||
private Long typeId;
|
||||
|
||||
/** 电子围栏ID */
|
||||
private Long electonicId;
|
||||
|
||||
/** 电机厂商 */
|
||||
private String motor;
|
||||
|
||||
/** 电池厂商 */
|
||||
private String battery;
|
||||
|
||||
/** 电机编号 */
|
||||
private Long motorNumber;
|
||||
|
||||
/** 电池编号 */
|
||||
private Long batteryNumber;
|
||||
|
||||
/** 企业ID */
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String businessNam;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.zhiLian.vehicle.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhiLian.vehicle.domain.Fence;
|
||||
import com.zhiLian.vehicle.domain.Vehicle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 围栏Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
public interface FenceMapper extends BaseMapper<Fence>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询围栏
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 围栏
|
||||
*/
|
||||
public Fence selectFenceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询围栏列表
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 围栏集合
|
||||
*/
|
||||
public List<Fence> selectFenceList(Fence fence);
|
||||
|
||||
/**
|
||||
* 新增围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFence(Fence fence);
|
||||
|
||||
/**
|
||||
* 修改围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFence(Fence fence);
|
||||
|
||||
/**
|
||||
* 删除围栏
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFenceById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除围栏
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFenceByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.zhiLian.vehicle.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhiLian.vehicle.domain.Fence;
|
||||
import com.zhiLian.vehicle.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* 围栏Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
public interface IFenceService extends IService<Fence>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询围栏
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 围栏
|
||||
*/
|
||||
public Fence selectFenceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询围栏列表
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 围栏集合
|
||||
*/
|
||||
public List<Fence> selectFenceList(Fence fence);
|
||||
|
||||
/**
|
||||
* 新增围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFence(Fence fence);
|
||||
|
||||
/**
|
||||
* 修改围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFence(Fence fence);
|
||||
|
||||
/**
|
||||
* 批量删除围栏
|
||||
*
|
||||
* @param ids 需要删除的围栏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFenceByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除围栏信息
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFenceById(Long id);
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package com.zhiLian.vehicle.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhiLian.common.core.utils.DateUtils;
|
||||
import com.zhiLian.vehicle.domain.Fence;
|
||||
import com.zhiLian.vehicle.domain.Vehicle;
|
||||
import com.zhiLian.vehicle.mapper.FenceMapper;
|
||||
import com.zhiLian.vehicle.mapper.VehicleMapper;
|
||||
import com.zhiLian.vehicle.service.IFenceService;
|
||||
import com.zhiLian.vehicle.service.IVehicleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 围栏Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Service
|
||||
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence>
|
||||
implements IFenceService
|
||||
{
|
||||
@Autowired
|
||||
private FenceMapper fenceMapper;
|
||||
|
||||
/**
|
||||
* 查询围栏
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 围栏
|
||||
*/
|
||||
@Override
|
||||
public Fence selectFenceById(Long id)
|
||||
{
|
||||
return fenceMapper.selectFenceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询围栏列表
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 围栏
|
||||
*/
|
||||
@Override
|
||||
public List<Fence> selectFenceList(Fence fence)
|
||||
{
|
||||
return fenceMapper.selectFenceList(fence);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFence(Fence fence)
|
||||
{
|
||||
fence.setCreateTime(DateUtils.getNowDate());
|
||||
return fenceMapper.insertFence(fence);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏
|
||||
*
|
||||
* @param fence 围栏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFence(Fence fence)
|
||||
{
|
||||
fence.setUpdateTime(DateUtils.getNowDate());
|
||||
return fenceMapper.updateFence(fence);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除围栏
|
||||
*
|
||||
* @param ids 需要删除的围栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFenceByIds(Long[] ids)
|
||||
{
|
||||
return fenceMapper.deleteFenceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除围栏信息
|
||||
*
|
||||
* @param id 围栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFenceById(Long id)
|
||||
{
|
||||
return fenceMapper.deleteFenceById(id);
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.zhiLian.common.core.utils.DateUtils;
|
|||
import com.zhiLian.common.security.utils.SecurityUtils;
|
||||
import com.zhiLian.common.system.domain.LoginUser;
|
||||
import com.zhiLian.common.system.domain.SysUser;
|
||||
import com.zhiLian.common.system.remote.RemoteFileService;
|
||||
import com.zhiLian.common.system.remote.RemoteUserService;
|
||||
import com.zhiLian.vehicle.domain.Vehicle;
|
||||
import com.zhiLian.vehicle.mapper.VehicleMapper;
|
||||
|
@ -28,6 +29,15 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
|||
@Autowired
|
||||
private VehicleMapper vehicleMapper;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
// @Autowired
|
||||
// private IBusinessService businessService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 查询车辆录入
|
||||
*
|
||||
|
@ -39,8 +49,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
|||
{
|
||||
return vehicleMapper.selectVehicleById(id);
|
||||
}
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆录入列表
|
||||
|
@ -51,13 +60,21 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
|||
@Override
|
||||
public List<Vehicle> selectVehicleList(Vehicle vehicle)
|
||||
{
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser user = remoteUserService.selectByUserId(loginUser.getUserid());
|
||||
if (user.getUserType().equals("00")) {
|
||||
return vehicleMapper.selectVehicleList(vehicle);
|
||||
}
|
||||
vehicle.setId(Long.valueOf(user.getUserType()));
|
||||
return vehicleMapper.selectVehicleList(vehicle);
|
||||
vehicle.setBusinessId(Long.valueOf(user.getUserType()));
|
||||
List<Vehicle> vehicles = vehicleMapper.selectVehicleList(vehicle);
|
||||
// vehicles.forEach(vehicle1 -> {
|
||||
// Result result = remoteFileService.getInfo(vehicle1.getId());
|
||||
// Business business = (Business) result.getData();
|
||||
// vehicle1.setBusinessNam(business.getName());
|
||||
// });
|
||||
|
||||
return vehicles;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,6 +86,9 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
|||
@Override
|
||||
public int insertVehicle(Vehicle vehicle)
|
||||
{
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser user = remoteUserService.selectByUserId(loginUser.getUserid());
|
||||
vehicle.setBusinessId(Long.valueOf(user.getUserType()));
|
||||
vehicle.setCreateTime(DateUtils.getNowDate());
|
||||
return vehicleMapper.insertVehicle(vehicle);
|
||||
}
|
||||
|
@ -82,6 +102,10 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
|||
@Override
|
||||
public int updateVehicle(Vehicle vehicle)
|
||||
{
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser user = remoteUserService.selectByUserId(loginUser.getUserid());
|
||||
vehicle.setBusinessId(Long.valueOf(user.getUserType()));
|
||||
vehicle.setCreateTime(DateUtils.getNowDate());
|
||||
vehicle.setUpdateTime(DateUtils.getNowDate());
|
||||
return vehicleMapper.updateVehicle(vehicle);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<?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.vehicle.mapper.FenceMapper">
|
||||
|
||||
<resultMap type="com.zhiLian.vehicle.domain.Fence" id="FenceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="fenceLongitudeLatitude" column="fenceLongitudeLatitude" />
|
||||
<result property="fenceDescription" column="fenceDescription" />
|
||||
<result property="isDelete" column="isDelete" />
|
||||
<result property="fenceState" column="fenceState" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFenceVo">
|
||||
select id, name, fenceLongitudeLatitude, fenceDescription, isDelete, fenceState, remark, create_by, create_time, update_by, update_time from fence
|
||||
</sql>
|
||||
|
||||
<select id="selectFenceList" parameterType="com.zhiLian.vehicle.domain.Fence" resultMap="FenceResult">
|
||||
<include refid="selectFenceVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="fenceLongitudeLatitude != null and fenceLongitudeLatitude != ''"> and fenceLongitudeLatitude = #{fenceLongitudeLatitude}</if>
|
||||
<if test="fenceDescription != null and fenceDescription != ''"> and fenceDescription = #{fenceDescription}</if>
|
||||
<if test="isDelete != null and isDelete != ''"> and isDelete = #{isDelete}</if>
|
||||
<if test="fenceState != null and fenceState != ''"> and fenceState = #{fenceState}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFenceById" parameterType="Long" resultMap="FenceResult">
|
||||
<include refid="selectFenceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertFence" parameterType="com.zhiLian.vehicle.domain.Fence" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fence
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude,</if>
|
||||
<if test="fenceDescription != null">fenceDescription,</if>
|
||||
<if test="isDelete != null">isDelete,</if>
|
||||
<if test="fenceState != null">fenceState,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="fenceLongitudeLatitude != null">#{fenceLongitudeLatitude},</if>
|
||||
<if test="fenceDescription != null">#{fenceDescription},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="fenceState != null">#{fenceState},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFence" parameterType="com.zhiLian.vehicle.domain.Fence">
|
||||
update fence
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude = #{fenceLongitudeLatitude},</if>
|
||||
<if test="fenceDescription != null">fenceDescription = #{fenceDescription},</if>
|
||||
<if test="isDelete != null">isDelete = #{isDelete},</if>
|
||||
<if test="fenceState != null">fenceState = #{fenceState},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFenceById" parameterType="Long">
|
||||
delete from fence where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFenceByIds" parameterType="String">
|
||||
delete from fence where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="battery" column="battery" />
|
||||
<result property="motorNumber" column="motor_number" />
|
||||
<result property="batteryNumber" column="battery_number" />
|
||||
<result property="enterpriseId" column="enterprise_id" />
|
||||
<result property="businessId" column="business_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectVehicleVo">
|
||||
select id, number, type_id, electonic_id, motor, battery, motor_number, battery_number, enterprise_id, remark, create_by, create_time, update_by, update_time from vehicle
|
||||
select id, number, type_id, electonic_id, motor, battery, motor_number, battery_number, business_id, remark, create_by, create_time, update_by, update_time from vehicle
|
||||
</sql>
|
||||
|
||||
<select id="selectVehicleList" parameterType="com.zhiLian.vehicle.domain.Vehicle" resultMap="VehicleResult">
|
||||
|
@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="battery != null and battery != ''"> and battery = #{battery}</if>
|
||||
<if test="motorNumber != null "> and motor_number = #{motorNumber}</if>
|
||||
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
|
||||
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
|
||||
<if test="businessId != null "> and business_id = #{businessId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="battery != null">battery,</if>
|
||||
<if test="motorNumber != null">motor_number,</if>
|
||||
<if test="batteryNumber != null">battery_number,</if>
|
||||
<if test="enterpriseId != null">enterprise_id,</if>
|
||||
<if test="businessId != null">business_id,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
|
@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="battery != null">#{battery},</if>
|
||||
<if test="motorNumber != null">#{motorNumber},</if>
|
||||
<if test="batteryNumber != null">#{batteryNumber},</if>
|
||||
<if test="enterpriseId != null">#{enterpriseId},</if>
|
||||
<if test="businessId != null">#{businessId},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
|
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="battery != null">battery = #{battery},</if>
|
||||
<if test="motorNumber != null">motor_number = #{motorNumber},</if>
|
||||
<if test="batteryNumber != null">battery_number = #{batteryNumber},</if>
|
||||
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
|
||||
<if test="businessId != null">business_id = #{businessId},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
|
|
Loading…
Reference in New Issue