feat:围栏,围栏组,高德
parent
0b3d79d7d7
commit
58333c29eb
|
@ -105,20 +105,23 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
||||||
.userType(String.valueOf(business.getId()))
|
.userType(String.valueOf(business.getId()))
|
||||||
.build();
|
.build();
|
||||||
Result add = remoteUserService.add(sysUser);
|
Result add = remoteUserService.add(sysUser);
|
||||||
httpConnectMysql(business);
|
|
||||||
if (redisTemplate.hasKey(business.getId()+business.getName())){
|
|
||||||
httpConnectMysql(business);
|
|
||||||
}else{
|
|
||||||
redisTemplate.opsForValue().set(business.getId()+business.getName(),String.valueOf(3306+business.getId()));
|
|
||||||
}
|
|
||||||
// redisTemplate.opsForValue().set(business.getName()+""+business.getId(),);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
public void httpConnectMysql(Business business){
|
public void httpConnectMysql(Business business){
|
||||||
|
if (business.getBusinessStates().equals(2) ) {
|
||||||
|
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
||||||
|
redisTemplate.opsForValue().set(business.getId()+business.getName(),String.valueOf(3306+business.getId()));
|
||||||
|
extracted(business);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void extracted(Business business) {
|
||||||
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";
|
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<String, String> hashMap = new HashMap<>();
|
||||||
hashMap.put("businessId",business.getId()+business.getName());
|
hashMap.put("businessId", business.getId()+ business.getName());
|
||||||
hashMap.put("mysqlPort",String.valueOf(3306+business.getId()));
|
hashMap.put("mysqlPort",String.valueOf(3306+ business.getId()));
|
||||||
String json = JSON.toJSONString(hashMap);
|
String json = JSON.toJSONString(hashMap);
|
||||||
// 3.创建连接与设置连接参数
|
// 3.创建连接与设置连接参数
|
||||||
URL urlObj = null;
|
URL urlObj = null;
|
||||||
|
@ -163,6 +166,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
|
||||||
public int updateBusiness(Business business)
|
public int updateBusiness(Business business)
|
||||||
{
|
{
|
||||||
business.setUpdateTime(DateUtils.getNowDate());
|
business.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
httpConnectMysql(business);
|
||||||
return businessMapper.updateBusiness(business);
|
return businessMapper.updateBusiness(business);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.zhiLian.common.log.enums.BusinessType;
|
||||||
import com.zhiLian.common.security.annotation.RequiresPermissions;
|
import com.zhiLian.common.security.annotation.RequiresPermissions;
|
||||||
import com.zhiLian.vehicle.domain.Fence;
|
import com.zhiLian.vehicle.domain.Fence;
|
||||||
import com.zhiLian.vehicle.service.IFenceService;
|
import com.zhiLian.vehicle.service.IFenceService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fence")
|
@RequestMapping("/fence")
|
||||||
|
@Log4j2
|
||||||
public class FenceController extends BaseController
|
public class FenceController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -46,6 +48,7 @@ public class FenceController extends BaseController
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Fence> list = fenceService.selectFenceList(fence);
|
List<Fence> list = fenceService.selectFenceList(fence);
|
||||||
|
log.info("list:{}",list);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
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.Group;
|
||||||
|
import com.zhiLian.vehicle.service.IGroupService;
|
||||||
|
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-06-02
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/group")
|
||||||
|
public class GroupController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IGroupService groupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Group>> list(Group group)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Group> list = groupService.selectGroupList(group);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出围栏组列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:export")
|
||||||
|
@Log(title = "围栏组", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Group group)
|
||||||
|
{
|
||||||
|
List<Group> list = groupService.selectGroupList(group);
|
||||||
|
ExcelUtil<Group> util = new ExcelUtil<Group>(Group.class);
|
||||||
|
util.exportExcel(response, list, "围栏组数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取围栏组详细信息
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(groupService.selectGroupById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏组
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:add")
|
||||||
|
@Log(title = "围栏组", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody Group group)
|
||||||
|
{
|
||||||
|
return toAjax(groupService.insertGroup(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改围栏组
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:edit")
|
||||||
|
@Log(title = "围栏组", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody Group group)
|
||||||
|
{
|
||||||
|
return toAjax(groupService.updateGroup(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏组
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:group:remove")
|
||||||
|
@Log(title = "围栏组", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(groupService.deleteGroupByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,20 @@
|
||||||
package com.zhiLian.vehicle.domain;
|
package com.zhiLian.vehicle.domain;
|
||||||
|
|
||||||
|
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.annotation.Excel;
|
||||||
import com.zhiLian.common.core.web.domain.BaseEntity;
|
import com.zhiLian.common.core.web.domain.BaseEntity;
|
||||||
|
import com.zhiLian.vehicle.domain.vo.Path;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,6 +23,12 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
* @author muyu
|
* @author muyu
|
||||||
* @date 2024-05-31
|
* @date 2024-05-31
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("fence")
|
||||||
public class Fence extends BaseEntity
|
public class Fence extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -24,6 +40,12 @@ public class Fence extends BaseEntity
|
||||||
@Excel(name = "围栏名称")
|
@Excel(name = "围栏名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "围栏组ID")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
/** 围栏经纬集合 */
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Path> path;
|
||||||
/** 围栏经纬 */
|
/** 围栏经纬 */
|
||||||
@Excel(name = "围栏经纬")
|
@Excel(name = "围栏经纬")
|
||||||
private String fenceLongitudeLatitude;
|
private String fenceLongitudeLatitude;
|
||||||
|
@ -31,6 +53,13 @@ public class Fence extends BaseEntity
|
||||||
/** 围栏备注 */
|
/** 围栏备注 */
|
||||||
@Excel(name = "围栏备注")
|
@Excel(name = "围栏备注")
|
||||||
private String fenceDescription;
|
private String fenceDescription;
|
||||||
|
/** 半径 */
|
||||||
|
@Excel(name = "半径")
|
||||||
|
private Double radius;
|
||||||
|
|
||||||
|
/** 驶入,驶出 */
|
||||||
|
@Excel(name = "驶入,驶出")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
/** 是否删除 0 不删除 1删除 */
|
/** 是否删除 0 不删除 1删除 */
|
||||||
@Excel(name = "是否删除 0 不删除 1删除")
|
@Excel(name = "是否删除 0 不删除 1删除")
|
||||||
|
@ -40,75 +69,6 @@ public class Fence extends BaseEntity
|
||||||
@Excel(name = "围栏状态")
|
@Excel(name = "围栏状态")
|
||||||
private String fenceState;
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.zhiLian.vehicle.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.zhiLian.common.core.annotation.Excel;
|
||||||
|
import com.zhiLian.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组对象 group
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("group")
|
||||||
|
public class Group extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 围栏组ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 围栏组名称 */
|
||||||
|
@Excel(name = "围栏组名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/** 修改时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -62,4 +62,7 @@ public class Vehicle extends BaseEntity
|
||||||
@Excel(name = "企业ID")
|
@Excel(name = "企业ID")
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
|
||||||
|
@Excel(name="围栏组ID")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zhiLian.vehicle.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BingRui.Hou
|
||||||
|
*
|
||||||
|
* @Description 描述
|
||||||
|
* @ClassName Path
|
||||||
|
* @Date 2024/06/02 10:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class Path {
|
||||||
|
private String Q;
|
||||||
|
private String R;
|
||||||
|
private String lng;
|
||||||
|
private String lat;
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.zhiLian.vehicle.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zhiLian.vehicle.domain.Group;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-02
|
||||||
|
*/
|
||||||
|
public interface GroupMapper extends BaseMapper<Group>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询围栏组
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 围栏组
|
||||||
|
*/
|
||||||
|
public Group selectGroupById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 围栏组集合
|
||||||
|
*/
|
||||||
|
public List<Group> selectGroupList(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertGroup(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateGroup(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏组
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGroupById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除围栏组
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGroupByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.zhiLian.vehicle.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhiLian.vehicle.domain.Fence;
|
||||||
|
import com.zhiLian.vehicle.domain.Group;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-02
|
||||||
|
*/
|
||||||
|
public interface IGroupService extends IService<Group>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询围栏组
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 围栏组
|
||||||
|
*/
|
||||||
|
public Group selectGroupById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 围栏组集合
|
||||||
|
*/
|
||||||
|
public List<Group> selectGroupList(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertGroup(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateGroup(Group group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除围栏组
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的围栏组主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGroupByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏组信息
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGroupById(Long id);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.zhiLian.vehicle.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhiLian.common.core.utils.DateUtils;
|
import com.zhiLian.common.core.utils.DateUtils;
|
||||||
import com.zhiLian.vehicle.domain.Fence;
|
import com.zhiLian.vehicle.domain.Fence;
|
||||||
|
@ -60,6 +61,9 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence>
|
||||||
@Override
|
@Override
|
||||||
public int insertFence(Fence fence)
|
public int insertFence(Fence fence)
|
||||||
{
|
{
|
||||||
|
// String jsonString = JSON.toJSONString(fence.getPath());
|
||||||
|
String string = fence.getPath().toString();
|
||||||
|
fence.setFenceLongitudeLatitude(string);
|
||||||
fence.setCreateTime(DateUtils.getNowDate());
|
fence.setCreateTime(DateUtils.getNowDate());
|
||||||
return fenceMapper.insertFence(fence);
|
return fenceMapper.insertFence(fence);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.zhiLian.vehicle.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
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.Group;
|
||||||
|
import com.zhiLian.vehicle.mapper.FenceMapper;
|
||||||
|
import com.zhiLian.vehicle.mapper.GroupMapper;
|
||||||
|
import com.zhiLian.vehicle.service.IFenceService;
|
||||||
|
import com.zhiLian.vehicle.service.IGroupService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-02
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group>
|
||||||
|
implements IGroupService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private GroupMapper groupMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 围栏组
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Group selectGroupById(Long id)
|
||||||
|
{
|
||||||
|
return groupMapper.selectGroupById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 围栏组
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Group> selectGroupList(Group group)
|
||||||
|
{
|
||||||
|
return groupMapper.selectGroupList(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertGroup(Group group)
|
||||||
|
{
|
||||||
|
group.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return groupMapper.insertGroup(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改围栏组
|
||||||
|
*
|
||||||
|
* @param group 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateGroup(Group group)
|
||||||
|
{
|
||||||
|
return groupMapper.updateGroup(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除围栏组
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的围栏组主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteGroupByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return groupMapper.deleteGroupByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏组信息
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteGroupById(Long id)
|
||||||
|
{
|
||||||
|
return groupMapper.deleteGroupById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<resultMap type="com.zhiLian.vehicle.domain.Fence" id="FenceResult">
|
<resultMap type="com.zhiLian.vehicle.domain.Fence" id="FenceResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
<result property="groupId" column="group_id" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="fenceLongitudeLatitude" column="fenceLongitudeLatitude" />
|
<result property="fenceLongitudeLatitude" column="fenceLongitudeLatitude" />
|
||||||
<result property="fenceDescription" column="fenceDescription" />
|
<result property="fenceDescription" column="fenceDescription" />
|
||||||
|
@ -16,16 +17,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="radius" column="radius" />
|
||||||
|
<result property="eventType" column="event_type" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectFenceVo">
|
<sql id="selectFenceVo">
|
||||||
select id, name, fenceLongitudeLatitude, fenceDescription, isDelete, fenceState, remark, create_by, create_time, update_by, update_time from fence
|
select id,group_id, name,radius,event_type, fenceLongitudeLatitude, fenceDescription, isDelete, fenceState, remark, create_by, create_time, update_by, update_time from fence
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectFenceList" parameterType="com.zhiLian.vehicle.domain.Fence" resultMap="FenceResult">
|
<select id="selectFenceList" parameterType="com.zhiLian.vehicle.domain.Fence" resultMap="FenceResult">
|
||||||
<include refid="selectFenceVo"/>
|
<include refid="selectFenceVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="groupId != null and groupId != ''"> and group_id like concat('%', #{groupId}, '%')</if>
|
||||||
|
<if test="radius != null and radius != ''"> and radius like concat('%', #{radius}, '%')</if>
|
||||||
|
<if test="eventType != null and eventType != ''"> and event_type like concat('%', #{eventType}, '%')</if>
|
||||||
<if test="fenceLongitudeLatitude != null and fenceLongitudeLatitude != ''"> and fenceLongitudeLatitude = #{fenceLongitudeLatitude}</if>
|
<if test="fenceLongitudeLatitude != null and fenceLongitudeLatitude != ''"> and fenceLongitudeLatitude = #{fenceLongitudeLatitude}</if>
|
||||||
<if test="fenceDescription != null and fenceDescription != ''"> and fenceDescription = #{fenceDescription}</if>
|
<if test="fenceDescription != null and fenceDescription != ''"> and fenceDescription = #{fenceDescription}</if>
|
||||||
<if test="isDelete != null and isDelete != ''"> and isDelete = #{isDelete}</if>
|
<if test="isDelete != null and isDelete != ''"> and isDelete = #{isDelete}</if>
|
||||||
|
@ -42,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
insert into fence
|
insert into fence
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null">name,</if>
|
<if test="name != null">name,</if>
|
||||||
|
<if test="groupId != null">group_id,</if>
|
||||||
|
<if test="radius != null">radius,</if>
|
||||||
|
<if test="eventType != null">event_type,</if>
|
||||||
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude,</if>
|
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude,</if>
|
||||||
<if test="fenceDescription != null">fenceDescription,</if>
|
<if test="fenceDescription != null">fenceDescription,</if>
|
||||||
<if test="isDelete != null">isDelete,</if>
|
<if test="isDelete != null">isDelete,</if>
|
||||||
|
@ -54,6 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null">#{name},</if>
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="groupId != null">#{groupId},</if>
|
||||||
|
<if test="radius != null">#{radius},</if>
|
||||||
|
<if test="eventType != null">#{eventType},</if>
|
||||||
<if test="fenceLongitudeLatitude != null">#{fenceLongitudeLatitude},</if>
|
<if test="fenceLongitudeLatitude != null">#{fenceLongitudeLatitude},</if>
|
||||||
<if test="fenceDescription != null">#{fenceDescription},</if>
|
<if test="fenceDescription != null">#{fenceDescription},</if>
|
||||||
<if test="isDelete != null">#{isDelete},</if>
|
<if test="isDelete != null">#{isDelete},</if>
|
||||||
|
@ -70,6 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
update fence
|
update fence
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="name != null">name = #{name},</if>
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="groupId != null">group_id = #{groupId},</if>
|
||||||
|
<if test="eventType != null">event_type = #{eventType},</if>
|
||||||
|
<if test="radius != null">radius = #{radius},</if>
|
||||||
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude = #{fenceLongitudeLatitude},</if>
|
<if test="fenceLongitudeLatitude != null">fenceLongitudeLatitude = #{fenceLongitudeLatitude},</if>
|
||||||
<if test="fenceDescription != null">fenceDescription = #{fenceDescription},</if>
|
<if test="fenceDescription != null">fenceDescription = #{fenceDescription},</if>
|
||||||
<if test="isDelete != null">isDelete = #{isDelete},</if>
|
<if test="isDelete != null">isDelete = #{isDelete},</if>
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?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.GroupMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.zhiLian.vehicle.domain.Group" id="GroupResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="groupName" column="group_name" />
|
||||||
|
<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="selectGroupVo">
|
||||||
|
select id, group_name, remark, create_by, create_time, update_by, update_time from `group`
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectGroupList" parameterType="com.zhiLian.vehicle.domain.Group" resultMap="GroupResult">
|
||||||
|
<include refid="selectGroupVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||||
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectGroupById" parameterType="Long" resultMap="GroupResult">
|
||||||
|
<include refid="selectGroupVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertGroup" parameterType="com.zhiLian.vehicle.domain.Group" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into `group`
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupName != null">group_name,</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="groupName != null">#{groupName},</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="updateGroup" parameterType="com.zhiLian.vehicle.domain.Group">
|
||||||
|
update `group`
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="groupName != null">group_name = #{groupName},</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="deleteGroupById" parameterType="Long">
|
||||||
|
delete from `group` where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteGroupByIds" parameterType="String">
|
||||||
|
delete from `group` where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="groupId" column="group_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectVehicleVo">
|
<sql id="selectVehicleVo">
|
||||||
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
|
select id, number,group_id, type_id, electonic_id, motor, battery, motor_number, battery_number, business_id, remark, create_by, create_time, update_by, update_time from vehicle
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectVehicleList" parameterType="com.zhiLian.vehicle.domain.Vehicle" resultMap="VehicleResult">
|
<select id="selectVehicleList" parameterType="com.zhiLian.vehicle.domain.Vehicle" resultMap="VehicleResult">
|
||||||
|
@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="motorNumber != null "> and motor_number = #{motorNumber}</if>
|
<if test="motorNumber != null "> and motor_number = #{motorNumber}</if>
|
||||||
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
|
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
|
||||||
<if test="businessId != null "> and business_id = #{businessId}</if>
|
<if test="businessId != null "> and business_id = #{businessId}</if>
|
||||||
|
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="groupId != null">group_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
|
@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="groupId != null">#{groupId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -97,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="groupId != null">group_id = #{groupId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
Loading…
Reference in New Issue