fast()电子围栏
parent
cd75cdf286
commit
15edaa28f1
|
@ -0,0 +1,42 @@
|
|||
package com.business.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 电子围栏
|
||||
*/
|
||||
@Data
|
||||
public class Fence {
|
||||
/**
|
||||
* 电子围栏主键
|
||||
*/
|
||||
private Long fenceId;
|
||||
/**
|
||||
* 围栏组主键
|
||||
*/
|
||||
private Long groupId;
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
private String fenceName;
|
||||
/**
|
||||
* 围栏类型
|
||||
*/
|
||||
private String fenceType;
|
||||
/**
|
||||
* 半径
|
||||
*/
|
||||
private Double radius;
|
||||
/**
|
||||
* 驶入驶出
|
||||
*/
|
||||
private String eventType;
|
||||
/**
|
||||
* 围栏状态
|
||||
*/
|
||||
private String staut;
|
||||
/**
|
||||
*坐标
|
||||
*/
|
||||
private String polygonPoints;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.business.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class FenceGroups {
|
||||
/**
|
||||
* 围栏组id
|
||||
*/
|
||||
private Long groupsId;
|
||||
|
||||
private Long carId;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupsName;
|
||||
/**
|
||||
* 电子围栏
|
||||
*/
|
||||
private List<Fence> fenceList;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.business.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LongitudeAndLatitude {
|
||||
private String polygonItem;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.business.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class Path {
|
||||
private String lat;
|
||||
private String lng;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.business.common.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GaoDeKey {
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String key = "0e95def81c998806b1a63910f7f51f3c";
|
||||
/**
|
||||
* 安全密匙
|
||||
*/
|
||||
private String securityKey = "8d4deb862b1c9ed85a32cb61d6ea7da9";
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import com.business.common.domain.Fence;
|
||||
import com.business.common.domain.FenceGroups;
|
||||
import com.business.common.domain.Path;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.goods.service.IMapService;
|
||||
import com.muyu.goods.service.impl.MapService;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("map")
|
||||
public class MapController extends BaseController {
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
|
||||
/**
|
||||
* 查看全部围栏组
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectFenceGroups")
|
||||
public Result<List<FenceGroups>> selectFenceGroups() {
|
||||
return success(iMapService.selectFenceGroups());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看全部电子围栏
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectFence")
|
||||
public Result<List<Fence>> selectFence() {
|
||||
return success(iMapService.selectFence());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看围栏组
|
||||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectFenceGroupsById/{carId}")
|
||||
public Result<FenceGroups> selectFenceGroupsById(@PathVariable Long carId){
|
||||
return success(iMapService.selectFenceGroupsById(carId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getSel")
|
||||
public Result<Path> getSel(@RequestBody List<Path> list){
|
||||
return success(iMapService.getSel(list));
|
||||
}
|
||||
|
||||
@PostMapping("setSel")
|
||||
public String setSel(Object r){
|
||||
return iMapService.setSel(r);
|
||||
}
|
||||
}
|
|
@ -61,4 +61,6 @@ public interface CarMapper
|
|||
public int deleteCarByCarIds(Long[] carIds);
|
||||
|
||||
Car query(Long carId);
|
||||
|
||||
Car carByCar();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.goods.mapper;
|
||||
|
||||
import com.business.common.domain.Fence;
|
||||
import com.business.common.domain.FenceGroups;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MapMapper {
|
||||
void indexFenceGroups(@Param("carId") Long carId, @Param("groupsName") String groupsName);
|
||||
|
||||
List<FenceGroups> selectFenceGroups();
|
||||
|
||||
List<Fence> selectFence();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import com.business.common.domain.Fence;
|
||||
import com.business.common.domain.FenceGroups;
|
||||
import com.business.common.domain.Path;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMapService {
|
||||
|
||||
List<FenceGroups> selectFenceGroups();
|
||||
|
||||
List<Fence> selectFence();
|
||||
|
||||
FenceGroups selectFenceGroupsById(Long carId);
|
||||
|
||||
List<Path> getSel(List<Path> list);
|
||||
|
||||
String setSel(Object r);
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.business.common.domain.Car;
|
||||
import com.business.common.domain.Enterprise;
|
||||
import com.muyu.goods.mapper.CarMapper;
|
||||
import com.muyu.goods.mapper.MapMapper;
|
||||
import com.muyu.goods.service.ICarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -23,6 +25,8 @@ public class CarServiceImpl implements ICarService
|
|||
private CarMapper carMapper;
|
||||
@Autowired
|
||||
private BusinessServiceImpl businessService;
|
||||
@Autowired
|
||||
private MapMapper mapMapper;
|
||||
|
||||
/**
|
||||
* 查询车辆信息
|
||||
|
@ -71,7 +75,13 @@ public class CarServiceImpl implements ICarService
|
|||
}
|
||||
System.out.println(enterprise);
|
||||
car.setOwnerId(enterprise.getId());
|
||||
return carMapper.insertCar(car);
|
||||
car.setVin(UUID.randomUUID().toString().replaceAll("-",""));
|
||||
int i = carMapper.insertCar(car);
|
||||
if (i>0) {
|
||||
Car car1 = carMapper.carByCar();
|
||||
mapMapper.indexFenceGroups(car1.getCarId(),"car"+car1.getCarId());
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.business.common.domain.Fence;
|
||||
import com.business.common.domain.FenceGroups;
|
||||
import com.business.common.domain.Path;
|
||||
import com.muyu.goods.mapper.MapMapper;
|
||||
import com.muyu.goods.service.IMapService;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class MapService implements IMapService {
|
||||
@Autowired
|
||||
private MapMapper mapMapper;
|
||||
|
||||
@Override
|
||||
public List<FenceGroups> selectFenceGroups() {
|
||||
List<FenceGroups> fenceGroupsList = mapMapper.selectFenceGroups();
|
||||
for (FenceGroups fenceGroups : fenceGroupsList) {
|
||||
if (selectFence() == null){
|
||||
continue;
|
||||
}
|
||||
List<Fence> fenceList = selectFence().stream().filter(fa -> fa.getGroupId() == fenceGroups.getGroupsId()).collect(Collectors.toList());
|
||||
fenceGroups.setFenceList(fenceList);
|
||||
}
|
||||
System.out.println(fenceGroupsList);
|
||||
return fenceGroupsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Fence> selectFence() {
|
||||
List<Fence> fenceList = mapMapper.selectFence();
|
||||
return fenceList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FenceGroups selectFenceGroupsById(Long carId) {
|
||||
List<FenceGroups> groups = selectFenceGroups().stream().filter(car -> car.getCarId() == carId).collect(Collectors.toList());
|
||||
return groups.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Path> getSel(List<Path> list) {
|
||||
System.out.println(list);
|
||||
String jsonString = JSONObject.toJSONString(list);
|
||||
Path path = JSONObject.parseObject(jsonString, Path.class);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.goods.mapper.BusinessMapper">
|
||||
|
||||
<resultMap type="com.muyu.goods.domain.Enterprise" id="EnterpriseResult">
|
||||
<resultMap type="com.business.common.domain.Enterprise" id="EnterpriseResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="enterpriseName" column="enterprise_name" />
|
||||
<result property="legalPerson" column="legal_person" />
|
||||
|
|
|
@ -42,6 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectCarVo"/>
|
||||
where car_id = #{carId}
|
||||
</select>
|
||||
<select id="carByCar" resultType="com.business.common.domain.Car">
|
||||
<include refid="selectCarVo"></include>
|
||||
ORDER BY id DESC LIMIT 1;
|
||||
</select>
|
||||
|
||||
<insert id="insertCar" parameterType="com.business.common.domain.Car" useGeneratedKeys="true" keyProperty="carId">
|
||||
insert into car
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?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.muyu.goods.mapper.MapMapper">
|
||||
|
||||
<resultMap type="com.business.common.domain.FenceGroups" id="FenceGroupsResult">
|
||||
<result property="groupsId" column="groups_id" />
|
||||
<result property="carId" column="car_id" />
|
||||
<result property="groupsName" column="groups_name" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.business.common.domain.Fence" id="FenceResult">
|
||||
<result property="fenceId" column="fence_id" />
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="fenceName" column="fence_name" />
|
||||
<result property="fenceType" column="fence_type" />
|
||||
<result property="radius" column="radius" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="polygonPoints" column="polygon_points" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="FenceGroupsVo">
|
||||
select groups_id, car_id, groups_name from fence_groups
|
||||
</sql>
|
||||
|
||||
<sql id="FencesVo">
|
||||
select fence_id, group_id, fence_name, fence_type, radius, event_type, staut, polygon_points from fence
|
||||
</sql>
|
||||
<insert id="indexFenceGroups">
|
||||
insert into fence_groups ( groups_id, car_id, groups_name )
|
||||
values (0,#{carId},#{groupsName});
|
||||
</insert>
|
||||
<select id="selectFenceGroups" resultType="com.business.common.domain.FenceGroups">
|
||||
<include refid="FenceGroupsVo"></include>
|
||||
</select>
|
||||
<select id="selectFence" resultType="com.business.common.domain.Fence">
|
||||
<include refid="FencesVo"></include>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.goods.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GaoDeKey {
|
||||
/**
|
||||
* key
|
||||
*/
|
||||
private String key = "0e95def81c998806b1a63910f7f51f3c";
|
||||
/**
|
||||
* 安全密匙
|
||||
*/
|
||||
private String securityKey = "8d4deb862b1c9ed85a32cb61d6ea7da9";
|
||||
}
|
|
@ -147,4 +147,5 @@ public class EnterpriseController extends BaseController
|
|||
public Result getLevel(Long id,Integer serviceLevel){
|
||||
return success(enterpriseService.getLevel(id,serviceLevel));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpRequest.BodyPublishers;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.goods.manage.SysUserRemote;
|
||||
import com.muyu.goods.pojo.HttpClient;
|
||||
import com.muyu.system.remote.RemoteSystemManageService;
|
||||
import muyu.goods.enterprise.client.config.EnterpriseConfig;
|
||||
|
@ -186,4 +177,5 @@ public class EnterpriseServiceImpl implements IEnterpriseService
|
|||
return "选择失败";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue