111
parent
b4076353ae
commit
1b9827bd0c
|
@ -6,7 +6,7 @@ import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
*
|
*
|
||||||
* @author zhiLian
|
* @author zhiLian
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = com.zhiLian.common.system.remote.factory.RemoteUserFallbackFactory.class)
|
||||||
public interface RemoteUserService {
|
public interface RemoteUserService {
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户信息
|
* 通过用户名查询用户信息
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package com.muyu.common.system.remote.factory;
|
package com.zhiLian.common.system.remote.factory;
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -31,13 +32,26 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
//好像写有 添加用户 远程调用是这个?不知道启动一下吧应该没问题OK 你先学 我自己再看看
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result add(SysUser user) {
|
public Result add(SysUser user) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LoginUser> info(String username) {
|
||||||
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result authRole(Long userId) {
|
||||||
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser selectByUserId(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
|
||||||
|
cn.muyu.common.system.remote.factory.RemoteUserFallbackFactory.SecretAutoConfiguration,
|
||||||
|
cn.muyu.common.system.remote.factory.RemoteUserFallbackFactory.secret.modules.cors.WebMvcConfiguration
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class GaoDe {
|
||||||
s.append("key=").append(key).append("&location=").append(log).append(",").append(lat);
|
s.append("key=").append(key).append("&location=").append(log).append(",").append(lat);
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.xiaohuang.business.domain.Business;
|
import com.xiaohuang.business.domain.Business;
|
||||||
import com.xiaohuang.business.mapper.BusinessMapper;
|
import com.xiaohuang.business.mapper.BusinessMapper;
|
||||||
|
import com.xiaohuang.business.remote.factory.RemoteUserLoginFactory;
|
||||||
import com.xiaohuang.business.service.IBusinessService;
|
import com.xiaohuang.business.service.IBusinessService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
@ -52,9 +53,10 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
@Override
|
@Override
|
||||||
public Business selectBusinessById(Long id)
|
public Business selectBusinessById(Long id)
|
||||||
{
|
{
|
||||||
return businessMapper.selectBusinessById(id);
|
return businessMapper.selectBusinessById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询企业列表
|
* 查询企业列表
|
||||||
*
|
*
|
||||||
|
@ -74,13 +76,19 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
return businessMapper.selectBusinessList(business);
|
return businessMapper.selectBusinessList(business);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
//新增企业
|
* 新增企业
|
||||||
|
*
|
||||||
|
* @param business 企业
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserLoginFactory remoteUserLoginFactory;
|
||||||
@Override
|
@Override
|
||||||
public int insertBusiness(Business business)
|
public int insertBusiness(Business business)
|
||||||
{
|
{
|
||||||
business.setCreateTime(DateUtils.getNowDate());
|
business.setCreateTime(DateUtils.getNowDate());
|
||||||
int i = this.baseMapper.insertBusiness(business);
|
int i = businessMapper.insertBusiness(business);
|
||||||
System.out.println(business);
|
System.out.println(business);
|
||||||
SysUser sysUser = SysUser.builder()
|
SysUser sysUser = SysUser.builder()
|
||||||
.userName(business.getName() + business.getId())
|
.userName(business.getName() + business.getId())
|
||||||
|
@ -88,76 +96,56 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||||
.nickName(business.getName())
|
.nickName(business.getName())
|
||||||
.email(business.getBusinessEmail())
|
.email(business.getBusinessEmail())
|
||||||
.phonenumber(business.getBusinessPhone())
|
.phonenumber(business.getBusinessPhone())
|
||||||
.loginIp("175.24.138.82")
|
.loginIp("111.229.102.61")
|
||||||
.userType(String.valueOf(business.getId()))
|
.userType(String.valueOf(business.getId()))
|
||||||
.build();
|
.build();
|
||||||
Result add = remoteUserService.add(sysUser);
|
Result add = remoteUserService.add(sysUser);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void httpConnectMysql(Business business){
|
public void httpConnectMysql(Business business){
|
||||||
if (business.getBusinessStates().equals(2)){
|
if (business.getBusinessStates().equals(2) ) {
|
||||||
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
if (!redisTemplate.hasKey(business.getId()+business.getName())){
|
||||||
redisTemplate.opsForValue().set(business.getId()+business.getName(), String.valueOf(3306+business.getId()));
|
redisTemplate.opsForValue().set(business.getId()+business.getName(),String.valueOf(3306+business.getId()));
|
||||||
extracted(business);
|
extracted(business);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void extracted(Business 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://175.24.138.82:10006/webhook/%E6%9C%AA%E5%91%BD%E5%90%8D%E9%A1%B9%E7%9B%AE";
|
|
||||||
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.创建连接与设置连接参数
|
||||||
//创建链接与设置连接参数
|
|
||||||
URL urlObj = null;
|
URL urlObj = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
urlObj = new URL(postUrl);
|
urlObj = new URL(postUrl);
|
||||||
|
|
||||||
HttpURLConnection httpConn = (HttpURLConnection) urlObj.openConnection();
|
HttpURLConnection httpConn = (HttpURLConnection) urlObj.openConnection();
|
||||||
|
|
||||||
httpConn.setRequestMethod("POST");
|
httpConn.setRequestMethod("POST");
|
||||||
httpConn.setRequestProperty("Charset","UTF-8");
|
httpConn.setRequestProperty("Charset", "UTF-8");
|
||||||
|
// POST请求且JSON数据,必须设置
|
||||||
//post请求且JSON数据,必须要设置
|
httpConn.setRequestProperty("Content-Type", "application/json");
|
||||||
httpConn.setRequestProperty("Content-Type","application/json");
|
// 打开输出流,默认是false
|
||||||
|
|
||||||
//打开输出流.默认是false
|
|
||||||
httpConn.setDoOutput(false);
|
|
||||||
|
|
||||||
//打开输入流.默认是true,
|
|
||||||
httpConn.setDoOutput(true);
|
httpConn.setDoOutput(true);
|
||||||
|
// 打开输入流,默认是true,可省略
|
||||||
//获取输出流和写数据
|
httpConn.setDoInput(true);
|
||||||
|
// 4.从HttpURLConnection获取输出流和写数据
|
||||||
OutputStream oStream = httpConn.getOutputStream();
|
OutputStream oStream = httpConn.getOutputStream();
|
||||||
|
|
||||||
oStream.write(json.getBytes());
|
oStream.write(json.getBytes());
|
||||||
oStream.flush();
|
oStream.flush();
|
||||||
|
// 5.发起http调用(getInputStream触发http请求)
|
||||||
//调用
|
if (httpConn.getResponseCode() != 200) {
|
||||||
if (httpConn.getResponseCode()!=200){
|
throw new Exception("调用服务端异常.");
|
||||||
throw new Exception("调用服务端异常");
|
|
||||||
}
|
}
|
||||||
|
// 6.从HttpURLConnection获取输入流和读数据
|
||||||
//获取输入流和读取数据
|
|
||||||
BufferedReader br = new BufferedReader(
|
BufferedReader br = new BufferedReader(
|
||||||
new InputStreamReader(httpConn.getInputStream())
|
new InputStreamReader(httpConn.getInputStream()));
|
||||||
);
|
|
||||||
|
|
||||||
String resultData = br.readLine();
|
String resultData = br.readLine();
|
||||||
|
System.out.println("从服务端返回结果: " + resultData);
|
||||||
System.out.println("服务端返回结果: "+ resultData);
|
// 7.关闭HttpURLConnection连接
|
||||||
|
|
||||||
//关闭链接
|
|
||||||
httpConn.disconnect();
|
httpConn.disconnect();
|
||||||
|
|
||||||
|
|
||||||
//打开输出流.
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectBusinessVo"/>
|
<include refid="selectBusinessVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="info" resultType="com.muyu.common.system.domain.LoginUser">
|
<select id="info" resultType="com.muyu.common.system.domain.LoginUser">
|
||||||
select * from sys_user where id=#{userId}
|
select * from sys_user where id=#{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.xiaohuang.vehicle.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.xiaohuang.vehicle.domain.Fence;
|
||||||
|
import com.xiaohuang.vehicle.service.IFenceService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fence")
|
||||||
|
@Log4j2
|
||||||
|
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);
|
||||||
|
log.info("list:{}",list);
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.xiaohuang.vehicle.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.xiaohuang.vehicle.domain.Group;
|
||||||
|
import com.xiaohuang.vehicle.service.IGroupService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,83 +13,59 @@ import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* 围栏对象 Fence
|
|
||||||
*
|
|
||||||
* @author xiaohuang
|
|
||||||
* on 2024/6/2
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("fence")
|
@TableName("fence")
|
||||||
public class Fence extends BaseEntity {
|
public class Fence extends BaseEntity
|
||||||
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/** 围栏主键 */
|
||||||
* 围栏主键
|
|
||||||
*/
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/** 围栏名称 */
|
||||||
* 围栏名称
|
|
||||||
*/
|
|
||||||
@Excel(name = "围栏名称")
|
@Excel(name = "围栏名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "围栏组ID")
|
||||||
@Excel(name = "围栏组Id")
|
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
|
/** 围栏经纬集合 */
|
||||||
/**
|
|
||||||
* 围栏经纬集合
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<Path> path;
|
private List<Path> path;
|
||||||
|
/** 围栏经纬 */
|
||||||
/**
|
|
||||||
* 围栏经纬
|
|
||||||
*/
|
|
||||||
@Excel(name = "围栏经纬")
|
@Excel(name = "围栏经纬")
|
||||||
private String fenceLongitudeLatitude;
|
private String fenceLongitudeLatitude;
|
||||||
|
|
||||||
/**
|
/** 围栏备注 */
|
||||||
* 围栏备注
|
|
||||||
*/
|
|
||||||
@Excel(name = "围栏备注")
|
@Excel(name = "围栏备注")
|
||||||
private String fenceDescription;
|
private String fenceDescription;
|
||||||
|
/** 半径 */
|
||||||
|
|
||||||
/**
|
|
||||||
* 半径
|
|
||||||
*/
|
|
||||||
@Excel(name = "半径")
|
@Excel(name = "半径")
|
||||||
private Double redius;
|
private Double radius;
|
||||||
|
|
||||||
|
/** 驶入,驶出 */
|
||||||
/**
|
@Excel(name = "驶入,驶出")
|
||||||
* 驶入,驶出
|
|
||||||
*/
|
|
||||||
@Excel(name = "驶入,驶出")
|
|
||||||
private String eventType;
|
private String eventType;
|
||||||
|
|
||||||
|
/** 是否删除 0 不删除 1删除 */
|
||||||
/**
|
@Excel(name = "是否删除 0 不删除 1删除")
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
@Excel(name = "是否删除 0否 1是")
|
|
||||||
private String isDelete;
|
private String isDelete;
|
||||||
|
|
||||||
|
/** 围栏状态 */
|
||||||
/**
|
|
||||||
* 围栏状态
|
|
||||||
*/
|
|
||||||
@Excel(name = "围栏状态")
|
@Excel(name = "围栏状态")
|
||||||
private String fenceState;
|
private String fenceState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.xiaohuang.vehicle.domain;
|
package com.xiaohuang.vehicle.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -9,36 +11,36 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
/**
|
import java.util.Date;
|
||||||
* 围栏组对象 Group
|
|
||||||
*
|
|
||||||
* @author xiaohuang
|
|
||||||
* on 2024/6/2
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组对象 group
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-02
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("group")
|
@TableName("group")
|
||||||
public class Group extends BaseEntity {
|
public class Group extends BaseEntity
|
||||||
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/** 围栏组ID */
|
||||||
* 围栏组id
|
|
||||||
*/
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/** 围栏组名称 */
|
||||||
* 围栏组名称
|
|
||||||
*/
|
|
||||||
@Excel(name = "围栏组名称")
|
@Excel(name = "围栏组名称")
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
|
||||||
|
/** 修改时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package com.xiaohuang.vehicle.domain;
|
package com.xiaohuang.vehicle.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -29,7 +27,6 @@ public class Vehicle extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 车辆主键 */
|
/** 车辆主键 */
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 车辆vin */
|
/** 车辆vin */
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
package com.xiaohuang.vehicle.domain.vo;
|
package com.xiaohuang.vehicle.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path
|
* BingRui.Hou
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @Description 描述
|
||||||
* on 2024/6/2
|
* @ClassName Path
|
||||||
|
* @Date 2024/06/02 10:48
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
public class Path {
|
public class Path {
|
||||||
|
|
||||||
private String Q;
|
private String Q;
|
||||||
private String R;
|
private String R;
|
||||||
private String lng;
|
private String lng;
|
||||||
private String lat;
|
private String lat;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,17 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入对象 VehicleReq
|
* 车辆录入对象 vehicle
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/2
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
public class VehicleReq {
|
public class VehicleReq
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
/** 车辆主键 */
|
/** 车辆主键 */
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.xiaohuang.vehicle.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiaohuang.vehicle.domain.Fence;
|
||||||
|
|
||||||
|
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,66 @@
|
||||||
|
package com.xiaohuang.vehicle.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xiaohuang.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,66 @@
|
||||||
|
package com.xiaohuang.vehicle.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiaohuang.vehicle.domain.Fence;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏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,64 @@
|
||||||
|
package com.xiaohuang.vehicle.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xiaohuang.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);
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.xiaohuang.vehicle.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.xiaohuang.vehicle.domain.Fence;
|
||||||
|
import com.xiaohuang.vehicle.mapper.FenceMapper;
|
||||||
|
import com.xiaohuang.vehicle.service.IFenceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏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)
|
||||||
|
{
|
||||||
|
// String jsonString = JSON.toJSONString(fence.getPath());
|
||||||
|
String string = fence.getPath().toString();
|
||||||
|
fence.setFenceLongitudeLatitude(string);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.xiaohuang.vehicle.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.xiaohuang.vehicle.domain.Group;
|
||||||
|
import com.xiaohuang.vehicle.mapper.GroupMapper;
|
||||||
|
import com.xiaohuang.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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?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.xiaohuang.vehicle.mapper.FenceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.xiaohuang.vehicle.domain.Fence" id="FenceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="groupId" column="group_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" />
|
||||||
|
<result property="radius" column="radius" />
|
||||||
|
<result property="eventType" column="event_type" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFenceVo">
|
||||||
|
select id,group_id, name,radius,event_type, fenceLongitudeLatitude, fenceDescription, isDelete, fenceState, remark, create_by, create_time, update_by, update_time from fence
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFenceList" parameterType="com.xiaohuang.vehicle.domain.Fence" resultMap="FenceResult">
|
||||||
|
<include refid="selectFenceVo"/>
|
||||||
|
<where>
|
||||||
|
<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="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.xiaohuang.vehicle.domain.Fence" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into fence
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<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="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="groupId != null">#{groupId},</if>
|
||||||
|
<if test="radius != null">#{radius},</if>
|
||||||
|
<if test="eventType != null">#{eventType},</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.xiaohuang.vehicle.domain.Fence">
|
||||||
|
update fence
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<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="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>
|
|
@ -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.xiaohuang.vehicle.mapper.GroupMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.xiaohuang.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.xiaohuang.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.xiaohuang.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.xiaohuang.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>
|
|
@ -13,21 +13,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="battery" column="battery" />
|
<result property="battery" column="battery" />
|
||||||
<result property="motorNumber" column="motor_number" />
|
<result property="motorNumber" column="motor_number" />
|
||||||
<result property="batteryNumber" column="battery_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="remark" column="remark" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<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, enterprise_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.xiaohuang.vehicle.domain.Vehicle" resultMap="VehicleResult">
|
<select id="selectVehicleList" parameterType="com.xiaohuang.vehicle.domain.Vehicle" resultMap="VehicleResult">
|
||||||
<include refid="selectVehicleVo"/>
|
<include refid="selectVehicleVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
<if test="number != null "> and number = #{number}</if>
|
<if test="number != null "> and number = #{number}</if>
|
||||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||||
<if test="electonicId != null "> and electonic_id = #{electonicId}</if>
|
<if test="electonicId != null "> and electonic_id = #{electonicId}</if>
|
||||||
|
@ -35,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="battery != null and battery != ''"> and battery = #{battery}</if>
|
<if test="battery != null and battery != ''"> and battery = #{battery}</if>
|
||||||
<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="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
|
<if test="businessId != null "> and business_id = #{businessId}</if>
|
||||||
|
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -55,13 +58,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="battery != null">battery,</if>
|
<if test="battery != null">battery,</if>
|
||||||
<if test="motorNumber != null">motor_number,</if>
|
<if test="motorNumber != null">motor_number,</if>
|
||||||
<if test="batteryNumber != null">battery_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="remark != null">remark,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<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>
|
||||||
</trim>
|
<if test="groupId != null">group_id,</if>
|
||||||
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="number != null">#{number},</if>
|
<if test="number != null">#{number},</if>
|
||||||
|
@ -71,13 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="battery != null">#{battery},</if>
|
<if test="battery != null">#{battery},</if>
|
||||||
<if test="motorNumber != null">#{motorNumber},</if>
|
<if test="motorNumber != null">#{motorNumber},</if>
|
||||||
<if test="batteryNumber != null">#{batteryNumber},</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="remark != null">#{remark},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<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>
|
||||||
</trim>
|
<if test="groupId != null">#{groupId},</if>
|
||||||
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateVehicle" parameterType="com.xiaohuang.vehicle.domain.Vehicle">
|
<update id="updateVehicle" parameterType="com.xiaohuang.vehicle.domain.Vehicle">
|
||||||
|
@ -90,12 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="battery != null">battery = #{battery},</if>
|
<if test="battery != null">battery = #{battery},</if>
|
||||||
<if test="motorNumber != null">motor_number = #{motorNumber},</if>
|
<if test="motorNumber != null">motor_number = #{motorNumber},</if>
|
||||||
<if test="batteryNumber != null">battery_number = #{batteryNumber},</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="remark != null">remark = #{remark},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<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