初始化
parent
fac31cb7a8
commit
86eb16420b
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-electronic</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-electronic-common</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||||
|
<version>2.2.8</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFence
|
||||||
|
* @Date:2024/9/17 16:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆电子围栏类")
|
||||||
|
@TableName(value = "car_fence",autoResultMap = true)
|
||||||
|
public class CarFence {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 业务类型ID
|
||||||
|
*/
|
||||||
|
private Integer clazzId;
|
||||||
|
/**
|
||||||
|
* 业务类型名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String clazzName;
|
||||||
|
/**
|
||||||
|
* 围栏类型ID
|
||||||
|
*/
|
||||||
|
private Integer typeId;
|
||||||
|
/**
|
||||||
|
* 围栏类型名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String typeName;
|
||||||
|
/**
|
||||||
|
* 围栏经纬度
|
||||||
|
*/
|
||||||
|
private String fenceText;
|
||||||
|
/**
|
||||||
|
* 围栏开始时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private Date fenceStart;
|
||||||
|
/**
|
||||||
|
* 围栏结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private Date fenceEnd;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy/MM/dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy/MM/dd hh:mm:ss")
|
||||||
|
private Date fenceCreate;
|
||||||
|
/**
|
||||||
|
* 中间表ID
|
||||||
|
*/
|
||||||
|
private Integer middleId;
|
||||||
|
|
||||||
|
public static CarFence carFenceBuild(CarFence carFence) {
|
||||||
|
return CarFence.builder()
|
||||||
|
.id(carFence.getId())
|
||||||
|
.name(carFence.getName())
|
||||||
|
.clazzId(carFence.getClazzId())
|
||||||
|
.typeId(carFence.getTypeId())
|
||||||
|
.fenceText(carFence.getFenceText())
|
||||||
|
.fenceStart(carFence.getFenceStart())
|
||||||
|
.fenceCreate(carFence.getFenceCreate())
|
||||||
|
.middleId(carFence.getMiddleId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceClazz
|
||||||
|
* @Date:2024/9/17 16:41
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆电子业务类型")
|
||||||
|
@TableName(value = "car_fence_clazz",autoResultMap = true)
|
||||||
|
public class CarFenceClazz {
|
||||||
|
/**
|
||||||
|
* 业务类型ID
|
||||||
|
*/
|
||||||
|
private Integer clazzId;
|
||||||
|
/**
|
||||||
|
* 业务类型名称
|
||||||
|
*/
|
||||||
|
private String clazzName;
|
||||||
|
|
||||||
|
public static CarFenceClazz carFenceClazzBuild(CarFenceClazz carFenceClazz) {
|
||||||
|
return CarFenceClazz.builder()
|
||||||
|
.clazzId(carFenceClazz.getClazzId())
|
||||||
|
.clazzName(carFenceClazz.getClazzName())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:Type
|
||||||
|
* @Date:2024/9/17 16:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆电子围栏类型")
|
||||||
|
@TableName(value = "car_fence_type",autoResultMap = true)
|
||||||
|
public class CarFenceType {
|
||||||
|
/**
|
||||||
|
* 围栏类型ID
|
||||||
|
*/
|
||||||
|
private Integer typeId;
|
||||||
|
/**
|
||||||
|
* 围栏类型名称
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
public static CarFenceType carFenceTypeBuild(CarFenceType carFenceType) {
|
||||||
|
return CarFenceType.builder()
|
||||||
|
.typeId(carFenceType.getTypeId())
|
||||||
|
.typeName(carFenceType.getTypeName())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:carMiddle
|
||||||
|
* @Date:2024/9/20 16:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆电子围栏中间表")
|
||||||
|
@TableName(value = "car_middle",autoResultMap = true)
|
||||||
|
public class CarMiddle {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中间表ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 电子围栏ID
|
||||||
|
*/
|
||||||
|
private Integer carFenceId;
|
||||||
|
/**
|
||||||
|
* 车辆ID
|
||||||
|
*/
|
||||||
|
private Integer carInformationId;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain.req
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceReq
|
||||||
|
* @Date:2024/9/17 16:26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Tag(name = "车辆电子围栏响应参数")
|
||||||
|
public class CarFenceReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 业务类型ID
|
||||||
|
*/
|
||||||
|
private String clazzId;
|
||||||
|
/**
|
||||||
|
* 围栏类型ID
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
/**
|
||||||
|
* 当前页
|
||||||
|
*/
|
||||||
|
@Schema(title = "当前页数", type = "Integer", defaultValue = "1", description = "当前页数")
|
||||||
|
private Integer pageNum=1;
|
||||||
|
/**
|
||||||
|
* 条数
|
||||||
|
*/
|
||||||
|
@Schema(title = "分页条数", type = "Integer", defaultValue = "10", description = "每页有多少条")
|
||||||
|
private Integer pageSize=10;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.muyu.domain.resq;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.domain.CarFence;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain.resq
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceResq
|
||||||
|
* @Date:2024/9/17 16:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆电子围栏类")
|
||||||
|
@TableName(value = "car_fence",autoResultMap = true)
|
||||||
|
public class CarFenceResq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏主键
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 业务类型名
|
||||||
|
*/
|
||||||
|
private String clazzName;
|
||||||
|
/**
|
||||||
|
* 围栏类型名
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
/**
|
||||||
|
* 围栏开始时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private Date fenceStart;
|
||||||
|
/**
|
||||||
|
* 围栏结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private Date fenceEnd;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(fallbackPatterns = "yyyy/MM/dd hh:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy/MM/dd hh:mm:ss")
|
||||||
|
private Date fenceCreate;
|
||||||
|
|
||||||
|
public static CarFenceResq carFenceResqListBuilder(CarFence etlDataScore) {
|
||||||
|
return CarFenceResq.builder()
|
||||||
|
.id(etlDataScore.getId())
|
||||||
|
.name(etlDataScore.getName())
|
||||||
|
.clazzName(etlDataScore.getClazzName())
|
||||||
|
.typeName(etlDataScore.getTypeName())
|
||||||
|
.fenceStart(etlDataScore.getFenceStart())
|
||||||
|
.fenceEnd(etlDataScore.getFenceEnd())
|
||||||
|
.fenceCreate(etlDataScore.getFenceCreate())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-server</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.muyu.server</groupId>
|
||||||
|
<artifactId>cloud-electronic</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.server;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:杨闪闪
|
||||||
|
* @Package:com.muyu.server.integration
|
||||||
|
* @Project:cloud-integration
|
||||||
|
* @name:Integration
|
||||||
|
* @Date:2024/9/17 下午9:56
|
||||||
|
*/
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class IntegrationApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(IntegrationApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.CarFenceClazz;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceClazzService
|
||||||
|
* @Date:2024/9/17 17:33
|
||||||
|
*/
|
||||||
|
public interface CarFenceClazzService extends IService<CarFenceClazz>{
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.CarFence;
|
||||||
|
import com.muyu.domain.req.CarFenceReq;
|
||||||
|
import com.muyu.domain.resq.CarFenceResq;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceService
|
||||||
|
* @Date:2024/9/17 16:54
|
||||||
|
*/
|
||||||
|
public interface CarFenceService extends IService<CarFence> {
|
||||||
|
/**
|
||||||
|
* 查询围栏信息
|
||||||
|
*/
|
||||||
|
public Page<CarFenceResq> selectCarFence(CarFenceReq req);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.CarFenceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceTypeService
|
||||||
|
* @Date:2024/9/17 17:29
|
||||||
|
*/
|
||||||
|
public interface CarFenceTypeService extends IService<CarFenceType>{
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.CarMiddle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarMiddleSerivce
|
||||||
|
* @Date:2024/9/20 16:34
|
||||||
|
*/
|
||||||
|
public interface CarMiddleSerivce extends IService<CarMiddle> {
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.domain.CarFenceClazz;
|
||||||
|
import com.muyu.server.mapper.CarFenceClazzMapper;
|
||||||
|
import com.muyu.server.service.CarFenceClazzService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service.impl
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceClazzServiceImpl
|
||||||
|
* @Date:2024/9/17 17:33
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CarFenceClazzServiceImpl
|
||||||
|
extends ServiceImpl<CarFenceClazzMapper, CarFenceClazz>
|
||||||
|
implements CarFenceClazzService {
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.CarFence;
|
||||||
|
import com.muyu.domain.CarFenceClazz;
|
||||||
|
import com.muyu.domain.CarFenceType;
|
||||||
|
import com.muyu.domain.req.CarFenceReq;
|
||||||
|
import com.muyu.domain.resq.CarFenceResq;
|
||||||
|
import com.muyu.server.mapper.CarFenceMapper;
|
||||||
|
import com.muyu.server.service.CarFenceClazzService;
|
||||||
|
import com.muyu.server.service.CarFenceService;
|
||||||
|
import com.muyu.server.service.CarFenceTypeService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service.impl
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceServiceImpl
|
||||||
|
* @Date:2024/9/17 16:57
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
public class CarFenceServiceImpl
|
||||||
|
extends ServiceImpl<CarFenceMapper, CarFence>
|
||||||
|
implements CarFenceService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarFenceClazzService carFenceClazzService;
|
||||||
|
@Autowired
|
||||||
|
private CarFenceTypeService carFenceTypeService;
|
||||||
|
/**
|
||||||
|
* 查询围栏信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<CarFenceResq> selectCarFence(CarFenceReq req) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<CarFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//数据来源类型
|
||||||
|
queryWrapper.eq(
|
||||||
|
StringUtils.isNoneEmpty(req.getName()),
|
||||||
|
CarFence::getName, req.getName()
|
||||||
|
);
|
||||||
|
queryWrapper.eq(
|
||||||
|
StringUtils.isNoneEmpty(req.getName()),
|
||||||
|
CarFence::getName, req.getName()
|
||||||
|
);
|
||||||
|
queryWrapper.eq(
|
||||||
|
StringUtils.isNoneEmpty(req.getName()),
|
||||||
|
CarFence::getName, req.getName()
|
||||||
|
);
|
||||||
|
|
||||||
|
//使用MyBatis-Plus的分页功能进行查询
|
||||||
|
Page<CarFence> carFencePage = this.page(
|
||||||
|
//创建分页参数,包括页码和每页显示的记录数
|
||||||
|
new Page<>(req.getPageNum(),
|
||||||
|
req.getPageSize()),
|
||||||
|
//传递查询条件
|
||||||
|
queryWrapper
|
||||||
|
);
|
||||||
|
List<CarFenceClazz> carFenceClazzList = carFenceClazzService.list()
|
||||||
|
.stream()
|
||||||
|
.map(CarFenceClazz::carFenceClazzBuild)
|
||||||
|
.toList();
|
||||||
|
List<CarFenceType> carFenceTypeList = carFenceTypeService.list()
|
||||||
|
.stream()
|
||||||
|
.map(CarFenceType::carFenceTypeBuild)
|
||||||
|
.toList();
|
||||||
|
List<CarFence> carFenceList = carFencePage.getRecords();
|
||||||
|
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
||||||
|
//构建一个新的分页响应对象
|
||||||
|
return new Page<>() {{
|
||||||
|
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
||||||
|
List<CarFenceResq> etlDataScoreRespList = carFencePage.getRecords().stream()
|
||||||
|
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
||||||
|
.map(CarFenceResq::carFenceResqListBuilder)
|
||||||
|
//收集流中的元素到列表中
|
||||||
|
.toList();
|
||||||
|
//设置分页响应中的记录列表
|
||||||
|
setRecords(etlDataScoreRespList);
|
||||||
|
//设置分页响应中的总记录数
|
||||||
|
setTotal(carFencePage.getTotal());
|
||||||
|
//设置分页响应中的当前页码
|
||||||
|
setCurrent(carFencePage.getCurrent());
|
||||||
|
//设置分页响应中的每页记录数
|
||||||
|
setSize(carFencePage.getSize());
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优化查询返回值
|
||||||
|
* @param carFenceList 电子围栏数据
|
||||||
|
* @param carFenceClazzList 业务数据
|
||||||
|
* @param carFenceTypeList 类型数据
|
||||||
|
*/
|
||||||
|
private void optimizeEntity(
|
||||||
|
List<CarFence> carFenceList,
|
||||||
|
List<CarFenceClazz> carFenceClazzList,
|
||||||
|
List<CarFenceType> carFenceTypeList) {
|
||||||
|
carFenceList.forEach(carFence -> {
|
||||||
|
carFenceClazzList.forEach(carFenceClazz -> {
|
||||||
|
if (carFenceClazz.getClazzId().equals(carFence.getClazzId())) {
|
||||||
|
carFence.setClazzName(carFenceClazz.getClazzName());
|
||||||
|
}else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
carFenceTypeList.forEach(carFenceType -> {
|
||||||
|
if (carFenceType.getTypeId().equals(carFence.getTypeId())) {
|
||||||
|
carFence.setTypeName(carFenceType.getTypeName());
|
||||||
|
}else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.domain.CarFenceType;
|
||||||
|
import com.muyu.server.mapper.CarFenceTypeMapper;
|
||||||
|
import com.muyu.server.service.CarFenceTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service.impl
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarFenceTypeServiceImpl
|
||||||
|
* @Date:2024/9/17 17:30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CarFenceTypeServiceImpl
|
||||||
|
extends ServiceImpl<CarFenceTypeMapper, CarFenceType>
|
||||||
|
implements CarFenceTypeService {
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.domain.CarMiddle;
|
||||||
|
import com.muyu.server.mapper.CarMiddleMapper;
|
||||||
|
import com.muyu.server.service.CarMiddleSerivce;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.service.impl
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:CarMiddleSerivceImpl
|
||||||
|
* @Date:2024/9/20 16:34
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CarMiddleSerivceImpl
|
||||||
|
extends ServiceImpl<CarMiddleMapper, CarMiddle>
|
||||||
|
implements CarMiddleSerivce {
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
//package com.muyu.server.util;
|
||||||
|
//
|
||||||
|
//import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
//import com.muyu.common.domain.Connect;
|
||||||
|
//import com.muyu.common.domain.req.ConnectReq;
|
||||||
|
//import lombok.extern.log4j.Log4j2;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import java.sql.Connection;
|
||||||
|
//import java.sql.PreparedStatement;
|
||||||
|
//import java.sql.ResultSet;
|
||||||
|
//import java.sql.SQLException;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @Author:张腾
|
||||||
|
// * @Package:com.muyu.server.util
|
||||||
|
// * @Project:cloud-integration
|
||||||
|
// * @name:BaseDao
|
||||||
|
// * @Date:2024/8/20 21:45
|
||||||
|
// */
|
||||||
|
//@Component
|
||||||
|
//@Log4j2
|
||||||
|
//public class JdbcHelper {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 连接池
|
||||||
|
// * @param connect 连接池对象参数 查询结构
|
||||||
|
// * @return 返回结果
|
||||||
|
// */
|
||||||
|
// public static DruidDataSource getConn( Connect connect) {
|
||||||
|
// while (0<connect.getMaxWaitTimes()){
|
||||||
|
// try {
|
||||||
|
// DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
// String dcp = connect.getDataConnParam();
|
||||||
|
// druidDataSource.setUrl(new ConnectReq().getUrl()
|
||||||
|
// +connect.getIpAddress()+":"+connect.getPort()+
|
||||||
|
// "/"+connect.getDatabaseName() +
|
||||||
|
// (dcp != null && !dcp.isEmpty()? "?" + dcp : ""));
|
||||||
|
// druidDataSource.setUsername(connect.getUserName());
|
||||||
|
// druidDataSource.setPassword(connect.getPassword());
|
||||||
|
// //"com.mysql.cj.jdbc.Driver"
|
||||||
|
// druidDataSource.setDriverClassName(new ConnectReq().getDRIVER());
|
||||||
|
// druidDataSource.setInitialSize(connect.getInitSize());
|
||||||
|
// druidDataSource.setMaxActive(connect.getMaxNumConn());
|
||||||
|
// druidDataSource.setMaxWait(connect.getMaxWaitTime());
|
||||||
|
//
|
||||||
|
// return druidDataSource;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("异常为:{}", String.valueOf(e));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询服务器上说有数据库名 连接池
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public static DruidDataSource getConnRs(String dataName) {
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
// druidDataSource.setUrl("jdbc:mysql://21.12.0.10:3306/"+dataName+"?useUnicode=true&characterEncoding" +
|
||||||
|
// "=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
|
||||||
|
// druidDataSource.setUsername("root");
|
||||||
|
// druidDataSource.setPassword("Bwie-8666");
|
||||||
|
// druidDataSource.setDriverClassName(new ConnectReq().getDRIVER());
|
||||||
|
//
|
||||||
|
// return druidDataSource;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("异常为:{}", String.valueOf(e));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询服务器上说有数据库中表名 连接池
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public static DruidDataSource getDataConnRs(String name) {
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
// druidDataSource.setUrl("jdbc:mysql://21.12.0.10:3306/"
|
||||||
|
// +name+
|
||||||
|
// "?useUnicode=true&characterEncoding=" +
|
||||||
|
// "utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
|
||||||
|
// druidDataSource.setUsername("root");
|
||||||
|
// druidDataSource.setPassword("Bwie-8666");
|
||||||
|
// druidDataSource.setDriverClassName(new ConnectReq().getDRIVER());
|
||||||
|
//
|
||||||
|
// return druidDataSource;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("异常为:{}", String.valueOf(e));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static void close(Connection connection,PreparedStatement preparedStatement,ResultSet resultSet) throws SQLException {
|
||||||
|
//
|
||||||
|
// if (null != connection){
|
||||||
|
// connection.close();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (null != preparedStatement){
|
||||||
|
// preparedStatement.close();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (null != resultSet){
|
||||||
|
// resultSet.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.muyu.server.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.util
|
||||||
|
* @Project:cloud-electronic
|
||||||
|
* @name:PaginationInterceptor
|
||||||
|
* @Date:2024/9/17 19:22
|
||||||
|
*/
|
||||||
|
public class PaginationInterceptor {
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.server.util;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletContextEvent;
|
||||||
|
import jakarta.servlet.ServletContextListener;
|
||||||
|
import jakarta.servlet.annotation.WebListener;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.util
|
||||||
|
* @Project:cloud-property
|
||||||
|
* @name:Thread
|
||||||
|
* @Date:2024/8/24 21:01
|
||||||
|
*/
|
||||||
|
@WebListener
|
||||||
|
public class Thread {
|
||||||
|
@WebListener
|
||||||
|
public class ThreadManagerListener implements ServletContextListener {
|
||||||
|
|
||||||
|
private ExecutorService executorService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
|
// 初始化并启动线程
|
||||||
|
executorService = Executors.newSingleThreadExecutor();
|
||||||
|
executorService.submit(() -> {
|
||||||
|
// 你的线程任务
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextDestroyed(ServletContextEvent sce) {
|
||||||
|
// 停止线程
|
||||||
|
executorService.shutdownNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue