Browse Source

ams social modlue test

master
zhangyeguang 3 months ago
parent
commit
86af6617c4
  1. 1
      .gitignore
  2. 6
      common/pom.xml
  3. 3
      common/src/main/java/com/jiagutech/ams/model/DeptItem.java
  4. 3
      common/src/main/java/com/jiagutech/ams/model/LoginUser.java
  5. 2
      common/src/main/java/com/jiagutech/ams/model/common/PageResult.java
  6. 4
      common/src/main/java/com/jiagutech/ams/model/dto/DeptDTO.java
  7. 3
      common/src/main/java/com/jiagutech/ams/model/dto/RoleDTO.java
  8. 1
      common/src/main/java/com/jiagutech/ams/model/dto/UserDTO.java
  9. 7
      pom.xml
  10. 49
      social/pom.xml
  11. 16
      social/src/main/java/com/jiagutech/ams/controller/DeviceController.java
  12. 30
      social/src/main/java/com/jiagutech/ams/controller/JobController.java
  13. 4
      social/src/main/java/com/jiagutech/ams/mapper/DeviceMapper.java
  14. 1
      social/src/main/java/com/jiagutech/ams/mapper/JobMapper.java
  15. 8
      social/src/main/java/com/jiagutech/ams/mapper/SortieMapper.java
  16. 7
      social/src/main/java/com/jiagutech/ams/mapper/TrackImageMapper.java
  17. 8
      social/src/main/java/com/jiagutech/ams/model/JobMapping.java
  18. 32
      social/src/main/java/com/jiagutech/ams/model/Locus.java
  19. 25
      social/src/main/java/com/jiagutech/ams/model/SortieMapping.java
  20. 30
      social/src/main/java/com/jiagutech/ams/model/TrackImageVO.java
  21. 32
      social/src/main/java/com/jiagutech/ams/model/TrackItem.java
  22. 24
      social/src/main/java/com/jiagutech/ams/model/TrackMapping.java
  23. 68
      social/src/main/java/com/jiagutech/ams/model/UavSortie.java
  24. 50
      social/src/main/java/com/jiagutech/ams/model/dto/SortieDTO.java
  25. 31
      social/src/main/java/com/jiagutech/ams/model/dto/TrackImageDTO.java
  26. 2
      social/src/main/java/com/jiagutech/ams/model/request/JobCreateRequest.java
  27. 13
      social/src/main/java/com/jiagutech/ams/model/response/JobItem.java
  28. 40
      social/src/main/java/com/jiagutech/ams/model/response/JobPolyItem.java
  29. 23
      social/src/main/java/com/jiagutech/ams/rest/CenterRestClient.java
  30. 44
      social/src/main/java/com/jiagutech/ams/rest/TrackRestClient.java
  31. 5
      social/src/main/java/com/jiagutech/ams/service/DeviceService.java
  32. 17
      social/src/main/java/com/jiagutech/ams/service/DeviceServiceImpl.java
  33. 7
      social/src/main/java/com/jiagutech/ams/service/JobService.java
  34. 69
      social/src/main/java/com/jiagutech/ams/service/JobServiceImpl.java
  35. 59
      social/src/main/java/com/jiagutech/ams/service/SortieService.java
  36. 368
      social/src/main/java/com/jiagutech/ams/utils/FlightTrackerUtils.java
  37. 13
      social/src/main/resources/mapper/JobMapper.xml
  38. 2
      social/src/main/resources/mapper/RegionMapper.xml
  39. 5
      social/src/main/resources/mapper/SortieMapper.xml
  40. 5
      social/src/main/resources/mapper/TrackImageMapper.xml
  41. 11
      system/pom.xml
  42. 2
      system/src/main/java/com/jiagutech/ams/model/UserMapping.java
  43. 1
      system/src/main/java/com/jiagutech/ams/model/request/UserRequest.java
  44. 1
      system/src/main/java/com/jiagutech/ams/service/UserServiceImpl.java
  45. 58
      web/pom.xml
  46. 40
      web/src/main/java/com/jiagutech/ams/common/RabbitConfig.java
  47. 27
      web/src/main/resources/application-dev.yml
  48. 26
      web/src/main/resources/application-zyg.yml
  49. 38
      web/src/main/resources/application.yml

1
.gitignore

@ -37,3 +37,4 @@ buildNumber.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar # https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar .mvn/wrapper/maven-wrapper.jar
.idea/

6
common/pom.xml

@ -96,6 +96,12 @@
<groupId>jakarta.servlet</groupId> <groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId> <artifactId>jakarta.servlet-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

3
common/src/main/java/com/jiagutech/ams/model/DeptItem.java

@ -14,8 +14,9 @@ import lombok.Data;
@Data @Data
public class DeptItem { public class DeptItem {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private String deptId;
private Long deptId;
private String deptName; private String deptName;
@JsonSerialize(using = ToStringSerializer.class)
private Long managerId; private Long managerId;
private String managerName; private String managerName;
private String managerPhone; private String managerPhone;

3
common/src/main/java/com/jiagutech/ams/model/LoginUser.java

@ -1,6 +1,8 @@
package com.jiagutech.ams.model; package com.jiagutech.ams.model;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.jiagutech.ams.model.dto.DeptDTO; import com.jiagutech.ams.model.dto.DeptDTO;
import com.jiagutech.ams.model.dto.RoleDTO; import com.jiagutech.ams.model.dto.RoleDTO;
import lombok.Data; import lombok.Data;
@ -28,6 +30,7 @@ public class LoginUser implements Serializable {
/** /**
* 用户ID * 用户ID
*/ */
@JsonSerialize(using = ToStringSerializer.class)
private Long userId; private Long userId;
/** /**

2
common/src/main/java/com/jiagutech/ams/model/common/PageResult.java

@ -26,7 +26,7 @@ public class PageResult<T> {
pageResult.setTotal(total); pageResult.setTotal(total);
pageResult.setPageSize(pageSize); pageResult.setPageSize(pageSize);
pageResult.setPageNum(pageNum); pageResult.setPageNum(pageNum);
pageResult.setPages(total % pageSize == 0 ? total / pageSize : total / pageSize + 1);
pageResult.setPages(total==0||pageSize==0?0:total % pageSize == 0 ? total / pageSize : total / pageSize + 1);
pageResult.setRecords(records); pageResult.setRecords(records);
return pageResult; return pageResult;
} }

4
common/src/main/java/com/jiagutech/ams/model/dto/DeptDTO.java

@ -1,6 +1,8 @@
package com.jiagutech.ams.model.dto; package com.jiagutech.ams.model.dto;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -16,7 +18,7 @@ import java.io.Serializable;
@TableName("ams_dept") @TableName("ams_dept")
public class DeptDTO implements Serializable { public class DeptDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
private String name; private String name;
} }

3
common/src/main/java/com/jiagutech/ams/model/dto/RoleDTO.java

@ -2,6 +2,8 @@ package com.jiagutech.ams.model.dto;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -18,6 +20,7 @@ import java.io.Serializable;
public class RoleDTO implements Serializable { public class RoleDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId @TableId
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
private String name; private String name;

1
common/src/main/java/com/jiagutech/ams/model/dto/UserDTO.java

@ -24,5 +24,6 @@ public class UserDTO {
private Integer delFlag = 0; private Integer delFlag = 0;
private Long regionCode; private Long regionCode;
private String regionPath; private String regionPath;
private String regionName;
} }

7
pom.xml

@ -55,6 +55,13 @@
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
</profile> </profile>
<profile>
<id>zyg</id>
<properties>
<profiles.active>zyg</profiles.active>
<logging.level>info</logging.level>
</properties>
</profile>
<profile> <profile>
<id>prod</id> <id>prod</id>
<properties> <properties>

49
social/pom.xml

@ -17,27 +17,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<profiles>
<profile>
<id>dev</id>
<properties>
<!-- 环境标识,需要与配置文件的名称相对应 -->
<profiles.active>dev</profiles.active>
<logging.level>info</logging.level>
</properties>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
<logging.level>info</logging.level>
</properties>
</profile>
</profiles>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.jiagutech</groupId> <groupId>com.jiagutech</groupId>
@ -83,6 +63,22 @@
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.5.5.Final</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.5.Final</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
@ -93,5 +89,16 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>org.locationtech.proj4j</groupId>
<artifactId>proj4j</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

16
social/src/main/java/com/jiagutech/ams/controller/DeviceController.java

@ -1,16 +1,17 @@
package com.jiagutech.ams.controller; package com.jiagutech.ams.controller;
import cn.dev33.satoken.annotation.SaCheckRole; import cn.dev33.satoken.annotation.SaCheckRole;
import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.common.R; import com.jiagutech.ams.model.common.R;
import com.jiagutech.ams.model.dto.DeviceDTO;
import com.jiagutech.ams.model.request.JobPageRequest;
import com.jiagutech.ams.model.response.DeviceInfo; import com.jiagutech.ams.model.response.DeviceInfo;
import com.jiagutech.ams.service.DeviceService; import com.jiagutech.ams.service.DeviceService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -39,4 +40,11 @@ public class DeviceController {
return R.ok(deviceService.onlineAndRound(maxLng, maxLat, minLng, minLat)); return R.ok(deviceService.onlineAndRound(maxLng, maxLat, minLng, minLat));
} }
@Operation(summary = "设备列表")
@PostMapping("/page")
@SaCheckRole("manager")
public R<PageResult<DeviceDTO>> page(@RequestBody PageRequest<Void> pageRequest) {
return R.ok(deviceService.page(pageRequest));
}
} }

30
social/src/main/java/com/jiagutech/ams/controller/JobController.java

@ -3,10 +3,13 @@ package com.jiagutech.ams.controller;
import cn.dev33.satoken.annotation.SaCheckRole; import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode; import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.jiagutech.ams.model.TrackImageVO;
import com.jiagutech.ams.model.TrackItem;
import com.jiagutech.ams.model.common.PageRequest; import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult; import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.common.R; import com.jiagutech.ams.model.common.R;
import com.jiagutech.ams.model.dto.JobTypeDTO; import com.jiagutech.ams.model.dto.JobTypeDTO;
import com.jiagutech.ams.model.dto.TrackImageDTO;
import com.jiagutech.ams.model.request.JobCreateRequest; import com.jiagutech.ams.model.request.JobCreateRequest;
import com.jiagutech.ams.model.request.JobPageRequest; import com.jiagutech.ams.model.request.JobPageRequest;
import com.jiagutech.ams.model.response.JobCreateResponse; import com.jiagutech.ams.model.response.JobCreateResponse;
@ -40,6 +43,7 @@ public class JobController {
public R<List<JobTypeDTO>> getJobTypes() { public R<List<JobTypeDTO>> getJobTypes() {
return R.ok(jobService.getJobTypes()); return R.ok(jobService.getJobTypes());
} }
@Operation(summary = "创建作业记录") @Operation(summary = "创建作业记录")
@PostMapping("/start") @PostMapping("/start")
@SaCheckRole("machinist") @SaCheckRole("machinist")
@ -50,13 +54,13 @@ public class JobController {
@Operation(summary = "更新作业状态") @Operation(summary = "更新作业状态")
@SaCheckRole(value = {"machinist", "admin"}, mode = SaMode.OR) @SaCheckRole(value = {"machinist", "admin"}, mode = SaMode.OR)
@PutMapping("/status") @PutMapping("/status")
public R<Void> updateJobStatus(@RequestParam("jobId") Long jobId, @RequestParam("status") Integer status) {
jobService.updateJobStatus(jobId, status);
public R<Void> updateJobStatus(@RequestParam("jobId") String jobId, @RequestParam("status") Integer status) {
jobService.updateJobStatus(Long.parseLong(jobId), status);
return R.ok(); return R.ok();
} }
@Operation(summary = "分页获取作业列表") @Operation(summary = "分页获取作业列表")
@SaCheckRole(value = {"machinist","gov","manager"}, mode = SaMode.OR)
@SaCheckRole(value = {"machinist", "gov", "manager"}, mode = SaMode.OR)
@PostMapping("/page") @PostMapping("/page")
public R<PageResult<JobItem>> getPages(@RequestBody PageRequest<JobPageRequest> pageRequest) { public R<PageResult<JobItem>> getPages(@RequestBody PageRequest<JobPageRequest> pageRequest) {
return R.ok(jobService.getPages(pageRequest)); return R.ok(jobService.getPages(pageRequest));
@ -72,12 +76,28 @@ public class JobController {
@PostMapping("/export") @PostMapping("/export")
@Operation(summary = "导出作业记录") @Operation(summary = "导出作业记录")
public void exportJobs(@RequestBody(required = false) JobPageRequest jobPageRequest, HttpServletResponse response){
public void exportJobs(@RequestBody(required = false) JobPageRequest jobPageRequest, HttpServletResponse response) {
jobService.exportJobs(jobPageRequest, response); jobService.exportJobs(jobPageRequest, response);
} }
@PostMapping("/exportByFarmer") @PostMapping("/exportByFarmer")
@Operation(summary = "导出作业记录") @Operation(summary = "导出作业记录")
public void exportByFarmer(@RequestBody(required = false) JobPageRequest jobPageRequest, HttpServletResponse response){
public void exportByFarmer(@RequestBody(required = false) JobPageRequest jobPageRequest, HttpServletResponse response) {
jobService.exportByFarmer(jobPageRequest, response); jobService.exportByFarmer(jobPageRequest, response);
} }
@GetMapping("/tracks/{jobId}")
@Operation(summary = "获取作业轨迹列表")
public R<List<TrackItem>> getTrackList(@PathVariable("jobId") Long jobId) {
return R.ok(jobService.getTrackList(jobId));
}
@Operation(summary = "上传作业图片")
@PostMapping("/jobImage")
public R uploadJobImages(@RequestBody TrackImageVO trackImageVO) {
jobService.saveJobImages(trackImageVO);
return R.ok();
}
} }

4
social/src/main/java/com/jiagutech/ams/mapper/DeviceMapper.java

@ -1,10 +1,12 @@
package com.jiagutech.ams.mapper; package com.jiagutech.ams.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiagutech.ams.model.dto.DeviceDTO;
import com.jiagutech.ams.model.response.DeviceInfo; import com.jiagutech.ams.model.response.DeviceInfo;
import java.util.List; import java.util.List;
public interface DeviceMapper {
public interface DeviceMapper extends BaseMapper<DeviceDTO> {
List<DeviceInfo> queryDeviceList(Long detpId); List<DeviceInfo> queryDeviceList(Long detpId);

1
social/src/main/java/com/jiagutech/ams/mapper/JobMapper.java

@ -1,6 +1,5 @@
package com.jiagutech.ams.mapper; package com.jiagutech.ams.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

8
social/src/main/java/com/jiagutech/ams/mapper/SortieMapper.java

@ -0,0 +1,8 @@
package com.jiagutech.ams.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiagutech.ams.model.dto.SortieDTO;
public interface SortieMapper extends BaseMapper<SortieDTO> {
}

7
social/src/main/java/com/jiagutech/ams/mapper/TrackImageMapper.java

@ -0,0 +1,7 @@
package com.jiagutech.ams.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiagutech.ams.model.dto.TrackImageDTO;
public interface TrackImageMapper extends BaseMapper<TrackImageDTO> {
}

8
social/src/main/java/com/jiagutech/ams/model/JobMapping.java

@ -3,9 +3,13 @@ package com.jiagutech.ams.model;
import com.jiagutech.ams.model.dto.JobDTO; import com.jiagutech.ams.model.dto.JobDTO;
import com.jiagutech.ams.model.request.JobCreateRequest; import com.jiagutech.ams.model.request.JobCreateRequest;
import com.jiagutech.ams.model.response.JobCreateResponse; import com.jiagutech.ams.model.response.JobCreateResponse;
import com.jiagutech.ams.model.response.JobItem;
import com.jiagutech.ams.model.response.JobPolyItem;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper @Mapper
public interface JobMapping { public interface JobMapping {
JobMapping INSTANCE = Mappers.getMapper(JobMapping.class); JobMapping INSTANCE = Mappers.getMapper(JobMapping.class);
@ -13,4 +17,8 @@ public interface JobMapping {
JobDTO jobCreateToJobDTO(JobCreateRequest job); JobDTO jobCreateToJobDTO(JobCreateRequest job);
JobCreateResponse jobDTOToJobCreateResponse(JobDTO job); JobCreateResponse jobDTOToJobCreateResponse(JobDTO job);
JobPolyItem jobItemToJobPolyItem(JobItem job);
List<JobPolyItem> jobItemListToJobPolyItemList(List<JobItem> jobList);
} }

32
social/src/main/java/com/jiagutech/ams/model/Locus.java

@ -0,0 +1,32 @@
package com.jiagutech.ams.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class Locus implements Serializable {
// 设备Id
private String vehicleId;
// 时间戳
private Long timestamp;
private Long recordTime;
// 纬度,最多保留7位小数(CGCS2000 坐标系)
private Double lat;
// 经度,最多保留7位小数(CGCS2000 坐标系)
private Double lng;
// 状态[1位数字](0=不工作,1=工作,3=合格)
private Integer status;
// 幅宽(米)[浮点数,最多保留两位小数]
private Double breadth;
// 速度(千米/小时<km/h>)[浮点数,最多保留一位小数]
private Double velocity;
// 耕深(厘米)[浮点数,最多保留一位小数]
private Double deep;
// 流量(脉冲值)[浮点数,最多保留一位小数]
private Double flow;
// 播种速度 粒/s生成对应的实体类
private Double seeding;
}

25
social/src/main/java/com/jiagutech/ams/model/SortieMapping.java

@ -0,0 +1,25 @@
package com.jiagutech.ams.model;
import com.jiagutech.ams.model.dto.SortieDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SortieMapping {
SortieMapping INSTANCE = Mappers.getMapper(SortieMapping.class);
@Mappings(
value = {
@Mapping(target = "workArea", source = "sprayArea"),
@Mapping(target = "latitude", source = "lat0"),
@Mapping(target = "longitude", source = "lng0"),
@Mapping(target = "startAt", source = "startTime"),
@Mapping(target = "endAt", source = "endTime"),
@Mapping(target = "vehicleId", source = "droneId"),
})
SortieDTO convertToSortieDTOByUavSortie(UavSortie uavSortie);
}

30
social/src/main/java/com/jiagutech/ams/model/TrackImageVO.java

@ -0,0 +1,30 @@
package com.jiagutech.ams.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName TrackImageDTO
* @author: zhangyeguang
* @create: 2024-09-09 14:12
* @Version 1.0
* @description:
**/
@Data
public class TrackImageVO {
private Long id;
private Long deviceId;
private Long timestamp;
private Double lat;
private Double lng;
private String vehicleId;
private String imageUrl;
}

32
social/src/main/java/com/jiagutech/ams/model/TrackItem.java

@ -0,0 +1,32 @@
package com.jiagutech.ams.model;
import lombok.Data;
/**
* @ClassName TrackItem
* @author: zhangyeguang
* @create: 2024-09-09 12:00
* @Version 1.0
* @description:
**/
@Data
public class TrackItem {
private Long timestamp;
private Double lat;
private Double lng;
private Float velocity;
private Float deep;
private Float flow;
private Float seeding;
private String imageUrl;
}

24
social/src/main/java/com/jiagutech/ams/model/TrackMapping.java

@ -0,0 +1,24 @@
package com.jiagutech.ams.model;
import com.jiagutech.ams.model.dto.TrackImageDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface TrackMapping {
TrackMapping INSTANCE = Mappers.getMapper(TrackMapping.class);
@Mappings(value = {
@Mapping(target = "boxNum", source = "vehicleId"),
@Mapping(target = "ts", source = "timestamp"),
})
TrackImageDTO convertToTrackImageDTOByVO(TrackImageVO trackImage);
TrackItem convertToTrackItemByLocus(Locus track);
}

68
social/src/main/java/com/jiagutech/ams/model/UavSortie.java

@ -0,0 +1,68 @@
package com.jiagutech.ams.model;
import lombok.Data;
@Data
public class UavSortie implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* 飞机ID
*/
private String droneId;
/**
* 起飞时间毫秒时间戳
*/
private Long startTime;
/**
* 降落时间毫秒时间戳
*/
private Long endTime;
/**
* 行政区划分编码江苏省 南京市 浦口区320111
*/
private Integer regionCode;
private Double lat0;
private Double lng0;
private Long flightTime;
/**
*
*/
private Float sprayArea;
/**
* 喷洒容量
*/
private Float sprayQuantity;
// 达标面积(亩)
private Float qualifiedWorkArea;
// 重复作业面积(亩)
private Float repeatWorkArea;
// 耕深(厘米)
private Float avgDeep;
// 合格率
private Float qualifiedRate;
// 行驶里程(米)
private Float distance;
// 作业类型,编码见附表1
private Long module;
// 总流量(单位:L)
private Float sumFlow;
// 总播种量 (单位:粒)
private Integer seedingNumber;
}

50
social/src/main/java/com/jiagutech/ams/model/dto/SortieDTO.java

@ -0,0 +1,50 @@
package com.jiagutech.ams.model.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName SoriteDTO
* @author: zhangyeguang
* @create: 2024-09-09 10:02
* @Version 1.0
* @description:
**/
@Data
@TableName("sortie_store")
public class SortieDTO {
@TableId
private Long Id;
private Long startAt;
private Long endAt;
private String vehicleId;
private Double longitude;
private Double latitude;
private Float workArea;
private Float RepeatWorkArea;
private Float qualifiedWorkArea;
private Float avgDeep;
private Float qualifiedRate;
private Float distance;
private Long module;
private Float sumFlow;
private Integer seedingNumber;
}

31
social/src/main/java/com/jiagutech/ams/model/dto/TrackImageDTO.java

@ -0,0 +1,31 @@
package com.jiagutech.ams.model.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @ClassName TrackImageDTO
* @author: zhangyeguang
* @create: 2024-09-09 14:12
* @Version 1.0
* @description:
**/
@Data
@TableName("track_image")
public class TrackImageDTO {
private Long id;
private Long deviceId;
private Long ts;
private Double lat;
private Double lng;
private String boxNum;
private String imageUrl;
}

2
social/src/main/java/com/jiagutech/ams/model/request/JobCreateRequest.java

@ -1,5 +1,6 @@
package com.jiagutech.ams.model.request; package com.jiagutech.ams.model.request;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers; import com.fasterxml.jackson.databind.deser.std.NumberDeserializers;
import com.jiagutech.ams.utils.StringToLongDeserializer; import com.jiagutech.ams.utils.StringToLongDeserializer;
@ -31,6 +32,7 @@ public class JobCreateRequest {
/** /**
* 区域 * 区域
*/ */
@JsonIgnore
private long regionCode; private long regionCode;
/** /**
* 设备ID * 设备ID

13
social/src/main/java/com/jiagutech/ams/model/response/JobItem.java

@ -17,15 +17,21 @@ import lombok.Data;
public class JobItem { public class JobItem {
@ExcelIgnore @ExcelIgnore
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long jobId;
@ExcelIgnore
private Long operatorId; private Long operatorId;
@ExcelIgnore
@JsonSerialize(using = ToStringSerializer.class)
private Long jobId;
@ExcelProperty(value = "机手") @ExcelProperty(value = "机手")
private String operatorName; private String operatorName;
@ExcelProperty(value = "机手手机号")
private String operatorPhone;
@ExcelIgnore @ExcelIgnore
@JsonSerialize(using = ToStringSerializer.class)
private Long farmerId; private Long farmerId;
@ExcelProperty(value = "农户") @ExcelProperty(value = "农户")
private String farmerName; private String farmerName;
@ExcelProperty(value = "农户手机号")
private String farmerPhone;
@ExcelIgnore @ExcelIgnore
private Long startTime; private Long startTime;
@ExcelIgnore @ExcelIgnore
@ -44,11 +50,14 @@ public class JobItem {
@ExcelProperty(value = "作业类型") @ExcelProperty(value = "作业类型")
private String typeName; private String typeName;
@ExcelIgnore @ExcelIgnore
@JsonSerialize(using = ToStringSerializer.class)
private Long deviceId; private Long deviceId;
@ExcelIgnore @ExcelIgnore
private long deptId; private long deptId;
@ExcelProperty(value = "合作社") @ExcelProperty(value = "合作社")
private String deptName; private String deptName;
@ExcelProperty(value = "作业地区")
private String regionName;
} }

40
social/src/main/java/com/jiagutech/ams/model/response/JobPolyItem.java

@ -0,0 +1,40 @@
package com.jiagutech.ams.model.response;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
/**
* @ClassName JobItem
* @author: zhangyeguang
* @create: 2024-09-02 15:18
* @Version 1.0
* @description:
**/
@Data
public class JobPolyItem {
@ExcelProperty(value = "农户")
private String farmerName;
@ExcelProperty(value = "农户手机号")
private String farmerPhone;
@ExcelProperty(value = "开始作业时间")
private String startTimeStr;
@ExcelProperty(value = "作业总面积")
private Float area;
@ExcelProperty(value = "作业类型")
private String typeName;
@ExcelProperty(value = "合作社")
private String deptName;
@ExcelProperty(value = "作业地区")
private String regionName;
}

23
social/src/main/java/com/jiagutech/ams/rest/CenterRestClient.java

@ -1,23 +0,0 @@
package com.jiagutech.ams.rest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
/**
* @ClassName CenterClient
* @author: zhangyeguang
* @create: 2024-09-03 16:32
* @Version 1.0
* @description:
**/
@Component
@Slf4j
@RequiredArgsConstructor
public class CenterRestClient {
private final RestTemplate restTemplate;
}

44
social/src/main/java/com/jiagutech/ams/rest/TrackRestClient.java

@ -0,0 +1,44 @@
package com.jiagutech.ams.rest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.TypeReference;
import com.jiagutech.ams.model.Locus;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName CenterClient
* @author: zhangyeguang
* @create: 2024-09-03 16:32
* @Version 1.0
* @description:
**/
@Component
@Slf4j
@RequiredArgsConstructor
public class TrackRestClient {
private final RestTemplate restTemplate;
@Value("${center-track.client.url}")
private String CenterTrackUrl;
public List<Locus> getTractorByDroneIdAndTime(String droneid, Long startTime, Long endTime) {
Map<String, Object> map = new HashMap<>();
map.put("droneid", droneid);
map.put("startTime", startTime);
map.put("endTime", endTime);
String res = restTemplate.getForObject(CenterTrackUrl + "?droneid={droneid}&start={startTime}&end={endTime}", String.class, map);
return JSON.parseObject(res, new TypeReference<List<Locus>>() {});
}
}

5
social/src/main/java/com/jiagutech/ams/service/DeviceService.java

@ -1,9 +1,14 @@
package com.jiagutech.ams.service; package com.jiagutech.ams.service;
import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.dto.DeviceDTO;
import com.jiagutech.ams.model.response.DeviceInfo; import com.jiagutech.ams.model.response.DeviceInfo;
import java.util.List; import java.util.List;
public interface DeviceService { public interface DeviceService {
List<DeviceInfo> onlineAndRound(double maxLng, double maxLat, double minLng, double minLat); List<DeviceInfo> onlineAndRound(double maxLng, double maxLat, double minLng, double minLat);
PageResult<DeviceDTO> page(PageRequest<Void> pageRequest);
} }

17
social/src/main/java/com/jiagutech/ams/service/DeviceServiceImpl.java

@ -4,12 +4,19 @@ import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole; import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiagutech.ams.constant.UserConstants; import com.jiagutech.ams.constant.UserConstants;
import com.jiagutech.ams.mapper.DeviceMapper; import com.jiagutech.ams.mapper.DeviceMapper;
import com.jiagutech.ams.model.LoginUser; import com.jiagutech.ams.model.LoginUser;
import com.jiagutech.ams.model.TrackDataJG; import com.jiagutech.ams.model.TrackDataJG;
import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.dto.DeviceDTO;
import com.jiagutech.ams.model.response.DeviceInfo; import com.jiagutech.ams.model.response.DeviceInfo;
import com.jiagutech.ams.model.response.JobItem;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -65,4 +72,14 @@ public class DeviceServiceImpl implements DeviceService {
} }
return deviceInfos; return deviceInfos;
} }
@Override
public PageResult<DeviceDTO> page(PageRequest<Void> pageRequest) {
Page<DeviceDTO> page = new Page(pageRequest.getPageNum(), pageRequest.getPageSize());
QueryWrapper<DeviceDTO> queryWrapper = Wrappers.query();
LoginUser loginUser = StpUtil.getSession().get(UserConstants.SYS_SESSION, new LoginUser());
queryWrapper.eq("dept_id",loginUser.getDept().getId());
Page<DeviceDTO> result = deviceMapper.selectPage(page, queryWrapper);
return PageResult.of((int) result.getTotal(), (int) pageRequest.getPageSize(), (int) result.getCurrent(), result.getRecords());
}
} }

7
social/src/main/java/com/jiagutech/ams/service/JobService.java

@ -1,8 +1,11 @@
package com.jiagutech.ams.service; package com.jiagutech.ams.service;
import com.jiagutech.ams.model.TrackImageVO;
import com.jiagutech.ams.model.TrackItem;
import com.jiagutech.ams.model.common.PageRequest; import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult; import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.dto.JobTypeDTO; import com.jiagutech.ams.model.dto.JobTypeDTO;
import com.jiagutech.ams.model.dto.TrackImageDTO;
import com.jiagutech.ams.model.request.JobCreateRequest; import com.jiagutech.ams.model.request.JobCreateRequest;
import com.jiagutech.ams.model.request.JobPageRequest; import com.jiagutech.ams.model.request.JobPageRequest;
import com.jiagutech.ams.model.response.JobCreateResponse; import com.jiagutech.ams.model.response.JobCreateResponse;
@ -25,4 +28,8 @@ public interface JobService {
void exportJobs(JobPageRequest jobPageRequest, HttpServletResponse response); void exportJobs(JobPageRequest jobPageRequest, HttpServletResponse response);
void exportByFarmer(JobPageRequest jobPageRequest, HttpServletResponse response); void exportByFarmer(JobPageRequest jobPageRequest, HttpServletResponse response);
List<TrackItem> getTrackList(Long jobId);
void saveJobImages(TrackImageVO trackImageDTO);
} }

69
social/src/main/java/com/jiagutech/ams/service/JobServiceImpl.java

@ -2,7 +2,7 @@ package com.jiagutech.ams.service;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.excel.EasyExcel;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -10,32 +10,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiagutech.ams.constant.UserConstants; import com.jiagutech.ams.constant.UserConstants;
import com.jiagutech.ams.exception.BizCode; import com.jiagutech.ams.exception.BizCode;
import com.jiagutech.ams.exception.BusinessException; import com.jiagutech.ams.exception.BusinessException;
import com.jiagutech.ams.mapper.JobMapper;
import com.jiagutech.ams.mapper.JobTypeMapper;
import com.jiagutech.ams.mapper.RegionMapper;
import com.jiagutech.ams.mapper.UserMapper;
import com.jiagutech.ams.model.JobMapping;
import com.jiagutech.ams.model.LoginUser;
import com.jiagutech.ams.mapper.*;
import com.jiagutech.ams.model.*;
import com.jiagutech.ams.model.common.PageRequest; import com.jiagutech.ams.model.common.PageRequest;
import com.jiagutech.ams.model.common.PageResult; import com.jiagutech.ams.model.common.PageResult;
import com.jiagutech.ams.model.dto.JobDTO;
import com.jiagutech.ams.model.dto.JobTypeDTO;
import com.jiagutech.ams.model.dto.RegionDTO;
import com.jiagutech.ams.model.dto.RoleDTO;
import com.jiagutech.ams.model.dto.*;
import com.jiagutech.ams.model.request.JobCreateRequest; import com.jiagutech.ams.model.request.JobCreateRequest;
import com.jiagutech.ams.model.request.JobPageRequest; import com.jiagutech.ams.model.request.JobPageRequest;
import com.jiagutech.ams.model.response.JobCreateResponse; import com.jiagutech.ams.model.response.JobCreateResponse;
import com.jiagutech.ams.model.response.JobItem; import com.jiagutech.ams.model.response.JobItem;
import com.jiagutech.ams.model.response.JobPolyItem;
import com.jiagutech.ams.rest.TrackRestClient;
import com.jiagutech.ams.utils.ExcelUtil; import com.jiagutech.ams.utils.ExcelUtil;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -52,12 +43,20 @@ import java.util.stream.Collectors;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class JobServiceImpl implements JobService { public class JobServiceImpl implements JobService {
private final JobMapper jobMapper; private final JobMapper jobMapper;
private final UserMapper userMapper; private final UserMapper userMapper;
private final RegionMapper regionMapper;
private final DeviceMapper deviceMapper;
private final JobTypeMapper jobTypeMapper; private final JobTypeMapper jobTypeMapper;
private final TrackRestClient trackRestClient;
private final TrackImageMapper trackImageMapper;
@Override @Override
public JobCreateResponse createJob(JobCreateRequest jobCreateRequest) { public JobCreateResponse createJob(JobCreateRequest jobCreateRequest) {
LoginUser loginUser = StpUtil.getSession().get(UserConstants.SYS_SESSION, new LoginUser()); LoginUser loginUser = StpUtil.getSession().get(UserConstants.SYS_SESSION, new LoginUser());
@ -83,6 +82,7 @@ public class JobServiceImpl implements JobService {
} }
@Override @Override
public PageResult<JobItem> getPages(PageRequest<JobPageRequest> pageRequest) { public PageResult<JobItem> getPages(PageRequest<JobPageRequest> pageRequest) {
JobPageRequest requestParam = pageRequest.getRequest(); JobPageRequest requestParam = pageRequest.getRequest();
@ -117,10 +117,45 @@ public class JobServiceImpl implements JobService {
public void exportByFarmer(JobPageRequest jobPageRequest, HttpServletResponse response) { public void exportByFarmer(JobPageRequest jobPageRequest, HttpServletResponse response) {
QueryWrapper<JobItem> queryWrapper = buildQueryWrapper(jobPageRequest); QueryWrapper<JobItem> queryWrapper = buildQueryWrapper(jobPageRequest);
List<JobItem> jobItems = jobMapper.jobListCountByFarmer(queryWrapper); List<JobItem> jobItems = jobMapper.jobListCountByFarmer(queryWrapper);
ExcelUtil.exportExcel(jobItems, "作业记录", JobItem.class, response);
List<JobPolyItem> jobPolyItems = JobMapping.INSTANCE.jobItemListToJobPolyItemList(jobItems);
ExcelUtil.exportExcel(jobPolyItems, "作业记录", JobPolyItem.class, response);
} }
@Override
public List<TrackItem> getTrackList(Long jobId) {
if (jobId != null) {
JobDTO job = jobMapper.selectById(jobId);
DeviceDTO deviceDTO = deviceMapper.selectById(job.getDeviceId());
List<Locus> locusList = trackRestClient.getTractorByDroneIdAndTime(deviceDTO.getBoxNum(), job.getStartTime(), job.getEndTime());
QueryWrapper<TrackImageDTO> query = Wrappers.query();
List<TrackImageDTO> trackImageDTOS = trackImageMapper.selectList(
query.eq("device_id", job.getDeviceId())
.between("ts", job.getStartTime(), job.getEndTime())
);
List<TrackItem> trackItems = new ArrayList<>(locusList.size());
for (Locus locus : locusList) {
TrackItem trackItem = TrackMapping.INSTANCE.convertToTrackItemByLocus(locus);
trackItem.setImageUrl(trackImageDTOS.stream().filter(t -> t.getTs() == locus.getTimestamp()).findFirst().map(t -> t.getImageUrl()).orElse(null));
trackItems.add(trackItem);
}
return trackItems;
}
return List.of();
}
@Override
public void saveJobImages(TrackImageVO trackImageVO) {
TrackImageDTO trackImageDTO = TrackMapping.INSTANCE.convertToTrackImageDTOByVO(trackImageVO);
QueryWrapper<DeviceDTO> query = Wrappers.query();
DeviceDTO deviceDTO = deviceMapper.selectOne(query.eq("box_num", trackImageDTO.getBoxNum()));
if (ObjectUtil.isNotEmpty(deviceDTO)) {
trackImageDTO.setDeviceId(deviceDTO.getId());
trackImageMapper.insert(trackImageDTO);
}
}
private QueryWrapper<JobItem> buildQueryWrapper(JobPageRequest requestParam) { private QueryWrapper<JobItem> buildQueryWrapper(JobPageRequest requestParam) {
QueryWrapper queryWrapper = Wrappers.query(); QueryWrapper queryWrapper = Wrappers.query();

59
social/src/main/java/com/jiagutech/ams/service/SortieService.java

@ -0,0 +1,59 @@
package com.jiagutech.ams.service;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jiagutech.ams.mapper.DeviceMapper;
import com.jiagutech.ams.mapper.SortieMapper;
import com.jiagutech.ams.model.SortieMapping;
import com.jiagutech.ams.model.UavSortie;
import com.jiagutech.ams.model.dto.SortieDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
/**
* @ClassName SortieService
* @author: zhangyeguang
* @create: 2024-09-09 09:32
* @Version 1.0
* @description:
**/
@Slf4j
@Component
@RequiredArgsConstructor
public class SortieService {
private final SortieMapper sortieMapper;
@RabbitListener(queues = "queue_amssortie_social")
public void receiveMessage(String message) {
log.info("receiveMessage: {}", message);
try {
UavSortie uavSortie = JSON.parseObject(message, UavSortie.class);
SortieDTO sortieDTO = SortieMapping.INSTANCE.convertToSortieDTOByUavSortie(uavSortie);
SortieDTO hasSorties = sortieMapper.selectOne(Wrappers.lambdaQuery(SortieDTO.class).eq(SortieDTO::getVehicleId, uavSortie.getStartTime()));
if (ObjectUtil.isNotEmpty(sortieDTO)) {
if (ObjectUtil.isNotEmpty(hasSorties)) {
sortieDTO.setId(hasSorties.getId());
sortieMapper.updateById(sortieDTO);
return;
}
sortieMapper.insert(sortieDTO);
}
} catch (Exception e) {
log.error("receiveMessage error", e);
}
}
// QueryWrapper<DeviceDTO> queryWrapper = Wrappers.query();
// DeviceDTO deviceDTO = deviceMapper.selectOne(queryWrapper.eq("device_id", sortieDTO.getVehicleId()));
// if (ObjectUtil.isNotEmpty(deviceDTO)) {
// Long DeviceId = deviceDTO.getId();
//
// }
}

368
social/src/main/java/com/jiagutech/ams/utils/FlightTrackerUtils.java

@ -0,0 +1,368 @@
package com.jiagutech.ams.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.locationtech.jts.geom.*;
import org.locationtech.proj4j.BasicCoordinateTransform;
import org.locationtech.proj4j.CRSFactory;
import org.locationtech.proj4j.CoordinateReferenceSystem;
import org.locationtech.proj4j.ProjCoordinate;
import java.io.FileReader;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
public class FlightTrackerUtils {
private static final double DEG_TO_RAD = Math.PI / 180;
private static final double RAD_TO_DEG = 180 / Math.PI;
// 架次最小轨迹点数量
private static final double MIN_POINT_COUNT = 10;
// 架次最小轨迹点密度
private static final double MIN_POINT_DENSITY = 1;
// 架次轨迹最大速度 dm/s
private static final double MAX_SPEED = 100;
// 架次轨迹最大间隔距离 单位:米
private static final double MAX_DISTANCE = 100;
// 架次轨迹最大时间间隔 单位:秒
private static final double MAX_DURATION = 90;
public static class PointTemp {
LocalDateTime timestamp;
double lat;
double lon;
int spd;
public PointTemp(LocalDateTime timestamp, double lat, double lon, int spd) {
this.timestamp = timestamp;
this.lat = lat;
this.lon = lon;
this.spd = spd;
}
}
public static class SortieTemp{
long startTime;
long endTime;
double area;
long duration;
String startGeom;
public long getDuration() {
return (endTime - startTime) / 1000;
}
public long getStartTime() {
return startTime;
}
public long getEndTime() {
return endTime;
}
public double getArea() {
return area;
}
public String getStartGeom() {
return startGeom;
}
public String toJson(){
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
}
public static double haversineDistance(double lat1, double lon1, double lat2, double lon2) {
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate coord1 = fromLatLngToPoint(lat1, lon1);
Coordinate coord2 = fromLatLngToPoint(lat2, lon2);
Point point1 = geometryFactory.createPoint(coord1);
Point point2 = geometryFactory.createPoint(coord2);
return point1.distance(point2);
}
public static List<List<PointTemp>> readAndProcessFlightData(String filePath) throws IOException {
List<PointTemp> points = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
try (CSVParser parser = CSVParser.parse(new FileReader(filePath), CSVFormat.DEFAULT.withHeader())) {
for (CSVRecord record : parser) {
LocalDateTime timestamp = LocalDateTime.parse(record.get("ts"), formatter);
double lat = Double.parseDouble(record.get("lat"));
double lon = Double.parseDouble(record.get("lon"));
int spd = Integer.parseInt(record.get("spd"));
points.add(new PointTemp(timestamp, lat, lon, spd));
}
}
points = removeStationaryPoints(points,0.5);
List<List<PointTemp>> segments = new ArrayList<>();
List<PointTemp> currentSegment = new ArrayList<>();
for (int i = 0; i < points.size() - 1; i++) {
PointTemp p1 = points.get(i);
PointTemp p2 = points.get(i + 1);
double distance = haversineDistance(p1.lat, p1.lon, p2.lat, p2.lon);
long timeDifference = java.time.Duration.between(p1.timestamp, p2.timestamp).getSeconds();
// double speed = distance / timeDifference;
if (p1.spd <= MAX_SPEED) {
if (distance <= MAX_DISTANCE && timeDifference <= MAX_DURATION) {
currentSegment.add(p1);
} else {
currentSegment.add(p1);
segments.add(currentSegment);
currentSegment = new ArrayList<>();
}
}
}
currentSegment.add(points.get(points.size() - 1));
segments.add(currentSegment);
return segments;
}
public static List<List<PointTemp>> readAndProcessFlightData(List<PointTemp> points) {
points = removeStationaryPoints(points,0.5);
List<List<PointTemp>> segments = new ArrayList<>();
List<PointTemp> currentSegment = new ArrayList<>();
for (int i = 0; i < points.size() - 1; i++) {
PointTemp p1 = points.get(i);
PointTemp p2 = points.get(i + 1);
double distance = haversineDistance(p1.lat, p1.lon, p2.lat, p2.lon);
long timeDifference = java.time.Duration.between(p1.timestamp, p2.timestamp).getSeconds();
// double speed = distance / timeDifference;
if (p1.spd <= MAX_SPEED) {
if (distance <= 100 && timeDifference <= 90) {
currentSegment.add(p1);
} else {
currentSegment.add(p1);
segments.add(currentSegment);
currentSegment = new ArrayList<>();
}
}
}
currentSegment.add(points.get(points.size() - 1));
segments.add(currentSegment);
return segments;
}
public static Coordinate fromLatLngToPoint(double lat, double lng) {
double x = lng * 20037508.34 / 180;
double y = Math.log(Math.tan((90 + lat) * DEG_TO_RAD / 2)) / DEG_TO_RAD;
y = y * 20037508.34 / 180;
return new Coordinate(x, y);
}
// public static double calculateArea(List<PointTemp> points) {
// if (points.size() < 3) {
// return 0;
// }
//
// GeometryFactory geometryFactory = new GeometryFactory();
// Coordinate[] coordinates = new Coordinate[points.size() + 1];
//
// for (int i = 0; i < points.size(); i++) {
// PointTemp point = points.get(i);
// coordinates[i] = fromLatLngToPoint(point.lat, point.lon);
// }
// coordinates[points.size()] = coordinates[0];
//
// Polygon polygon = geometryFactory.createPolygon(coordinates);
// double area = polygon.getArea();
//
// return area * 0.0001; // Convert to mu (亩)
// }
public static double calculateArea(List<PointTemp> points) {
if (points.size() < 3) {
return 0;
}
GeometryFactory geometryFactory = new GeometryFactory();
Coordinate[] coordinates = new Coordinate[points.size() + 1];
for (int i = 0; i < points.size(); i++) {
PointTemp point = points.get(i);
ProjCoordinate projCoord = fromLatLngToUTM(point.lat, point.lon);
coordinates[i] = new Coordinate(projCoord.x, projCoord.y);
}
coordinates[points.size()] = coordinates[0];
LinearRing shell = geometryFactory.createLinearRing(coordinates);
Polygon polygon = geometryFactory.createPolygon(shell);
double area = polygon.getArea();
return area * 0.0015; // Convert to mu (亩)
}
public static List<PointTemp> removeStationaryPoints(List<PointTemp> points, double threshold) {
List<PointTemp> filteredPoints = new ArrayList<>();
filteredPoints.add(points.get(0));
for (int i = 1; i < points.size(); i++) {
PointTemp previousPoint = points.get(i - 1);
PointTemp currentPoint = points.get(i);
double distance = haversineDistance(previousPoint.lat, previousPoint.lon, currentPoint.lat, currentPoint.lon);
if (distance >= threshold) {
filteredPoints.add(currentPoint);
}
}
return filteredPoints;
}
// public static Point toScreenCoordinates(PointTemp point, double minLat, double maxLat, double minLon, double maxLon, int width, int height) {
// int x = (int) ((point.lon - minLon) / (maxLon - minLon) * width);
// int y = (int) ((maxLat - point.lat) / (maxLat - minLat) * height);
// return new Point(x, y);
// }
// public static void saveTrajectoryToImage(List<PointTemp> group, String filename) {
// int width = 800;
// int height = 600;
//
// // 计算最小和最大经纬度
// double minLat = Double.MAX_VALUE;
// double maxLat = Double.MIN_VALUE;
// double minLon = Double.MAX_VALUE;
// double maxLon = Double.MIN_VALUE;
// for (PointTemp point : group) {
// minLat = Math.min(minLat, point.lat);
// maxLat = Math.max(maxLat, point.lat);
// minLon = Math.min(minLon, point.lon);
// maxLon = Math.max(maxLon, point.lon);
//
// }
//
// // 创建 BufferedImage
// BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// Graphics2D g = image.createGraphics();
//
// // 设置背景和轨迹颜色
// g.setColor(Color.WHITE);
// g.fillRect(0, 0, width, height);
// g.setColor(Color.BLUE);
//
// // 绘制轨迹
// for (int i = 0; i < group.size() - 1; i++) {
// PointTemp point1 = group.get(i);
// PointTemp point2 = group.get(i + 1);
// Point screenPoint1 = toScreenCoordinates(point1, minLat, maxLat, minLon, maxLon, width, height);
// Point screenPoint2 = toScreenCoordinates(point2, minLat, maxLat, minLon, maxLon, width, height);
// g.drawLine(screenPoint1.x, screenPoint1.y, screenPoint2.x, screenPoint2.y);
// }
//
//
// // 保存图像为 PNG 文件
// try {
// File pngFile = new File(filename);
//// pngFile.deleteOnExit();
//
// ImageIO.write(image, "png", pngFile);
// } catch (IOException e) {
// System.out.printf("保存图像文件失败: %s", e.getMessage());
// e.printStackTrace();
// }
// }
public static ProjCoordinate fromLatLngToUTM(double lat, double lon) {
CRSFactory crsFactory = new CRSFactory();
CoordinateReferenceSystem wgs84 = crsFactory.createFromName("EPSG:4326");
CoordinateReferenceSystem utm = crsFactory.createFromName("EPSG:32633"); // Choose the appropriate UTM zone
BasicCoordinateTransform transform = new BasicCoordinateTransform(wgs84, utm);
ProjCoordinate srcCoord = new ProjCoordinate(lon, lat);
ProjCoordinate dstCoord = new ProjCoordinate();
transform.transform(srcCoord, dstCoord);
return dstCoord;
}
public static List<PointTemp> getPointsTempFromCsv(String path) throws Exception {
List<PointTemp> points = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
try (CSVParser parser = CSVParser.parse(new FileReader(path), CSVFormat.DEFAULT.withHeader())) {
for (CSVRecord record : parser) {
LocalDateTime timestamp = LocalDateTime.parse(record.get("ts"), formatter);
double lat = Double.parseDouble(record.get("lat"));
double lon = Double.parseDouble(record.get("lon"));
int spd = Integer.parseInt(record.get("spd"));
points.add(new PointTemp(timestamp, lat, lon, spd));
}
}
return points;
}
public static List<SortieTemp> pointToSortie(List<PointTemp> points){
List<SortieTemp> sorties = new ArrayList<>();
List<List<PointTemp>> segments = readAndProcessFlightData(points);
for (int i = 0; i < segments.size(); i++) {
double area = calculateArea(segments.get(i));
if (segments.get(i).size() < MIN_POINT_COUNT || segments.get(i).size() / area < MIN_POINT_DENSITY){
continue;
}
SortieTemp sortieTemp = new SortieTemp();
sortieTemp.startTime = segments.get(i).get(0).timestamp.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
sortieTemp.endTime = segments.get(i).get(segments.get(i).size()-1).timestamp.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
sortieTemp.area = area;
sortieTemp.startGeom = segments.get(i).get(0).lat+" "+segments.get(i).get(0).lon;
sorties.add(sortieTemp);
}
return sorties;
}
public static void main(String[] args) throws Exception {
String filePath = "/Users/leesans/Documents/03_Source/jiagu/test/sorties/src/main/java/org/example/test0319.csv";
// List<List<PointTemp>> segments = readAndProcessFlightData(filePath);
// for (int i = 0; i < segments.size(); i++) {
// double area = calculateArea(segments.get(i));
// if (segments.get(i).size() < 30 || segments.get(i).size() / area < 1){
// continue;
// }
// SortieTemp sortieTemp = new SortieTemp();
// sortieTemp.startTime = segments.get(i).get(0).timestamp.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
// sortieTemp.endTime = segments.get(i).get(segments.get(i).size()-1).timestamp.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
// sortieTemp.area = area;
// saveTrajectoryToImage(segments.get(i), String.format("/Users/leesans/Documents/03_Source/jiagu/test/output/segment-%d.png", i + 1));
// System.out.printf("Segment %d size: %d area: %.2f mu density: %.2f first timestamp: %s end timestamp: %s%n", i + 1,
// segments.get(i).size(), area, segments.get(i).size() / area, segments.get(i).get(0).timestamp,
// segments.get(i).get(segments.get(i).size()-1).timestamp);
// System.out.println(sortieTemp.toJson());
// }
List<PointTemp> points = getPointsTempFromCsv(filePath);
List<SortieTemp> sorties = pointToSortie(points);
for (int i = 0; i < sorties.size(); i++) {
System.out.println(sorties.get(i).toJson());
}
}
}

13
social/src/main/resources/mapper/JobMapper.xml

@ -12,8 +12,11 @@
j.operator_id, j.operator_id,
FROM_UNIXTIME(j.start_time/1000,'%Y-%m-%d %H:%i:%s') as start_time_str, FROM_UNIXTIME(j.start_time/1000,'%Y-%m-%d %H:%i:%s') as start_time_str,
u1.nick_name as operator_name, u1.nick_name as operator_name,
u1.phone as operator_phone,
j.farmer_id, j.farmer_id,
u2.nick_name as farmer_name, u2.nick_name as farmer_name,
u2.phone as farmer_phone,
u2.region_name ,
j.job_type, j.job_type,
t.name as type_name, t.name as type_name,
d.id as dept_id, d.id as dept_id,
@ -23,8 +26,6 @@
left join ams_dept d on j.dept_id=d.id left join ams_dept d on j.dept_id=d.id
left join ams_user u1 on j.operator_id = u1.id left join ams_user u1 on j.operator_id = u1.id
left join ams_user u2 on j.farmer_id = u2.id left join ams_user u2 on j.farmer_id = u2.id
</sql> </sql>
<select id="jobPage" resultType="com.jiagutech.ams.model.response.JobItem"> <select id="jobPage" resultType="com.jiagutech.ams.model.response.JobItem">
@ -42,7 +43,10 @@
u2.nick_name as farmer_name, u2.nick_name as farmer_name,
j.job_type,t.name as type_name, j.job_type,t.name as type_name,
d.id as dept_id, d.id as dept_id,
d.name as dept_name
d.name as dept_name,
u2.phone as farmer_phone,
u2.region_name,
FROM_UNIXTIME(MIN(start_time)/1000,'%Y-%m-%d %H:%i:%s') as start_time_str
from ams_job_info j from ams_job_info j
left join ams_job_type t on j.job_type = t.id left join ams_job_type t on j.job_type = t.id
left join ams_dept d on j.dept_id=d.id left join ams_dept d on j.dept_id=d.id
@ -50,4 +54,7 @@
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
group by j.farmer_id,j.job_type,t.name,d.id,d.name,u2.nick_name group by j.farmer_id,j.job_type,t.name,d.id,d.name,u2.nick_name
</select> </select>
</mapper> </mapper>

2
social/src/main/resources/mapper/RegionMapper.xml

@ -41,7 +41,7 @@
) )
SELECT SELECT
GROUP_CONCAT(region_code ORDER BY level SEPARATOR '->') AS region_code, GROUP_CONCAT(region_code ORDER BY level SEPARATOR '->') AS region_code,
GROUP_CONCAT(region_name ORDER BY level SEPARATOR '->') AS regionName
GROUP_CONCAT(region_name ORDER BY level SEPARATOR '-') AS regionName
from cte from cte
</select> </select>
</mapper> </mapper>

5
social/src/main/resources/mapper/SortieMapper.xml

@ -0,0 +1,5 @@
<?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.jiagutech.ams.mapper.SortieMapper">
</mapper>

5
social/src/main/resources/mapper/TrackImageMapper.xml

@ -0,0 +1,5 @@
<?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.jiagutech.ams.mapper.TrackImageMapper">
</mapper>

11
system/pom.xml

@ -18,15 +18,18 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.jiagutech</groupId> <groupId>com.jiagutech</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>

2
system/src/main/java/com/jiagutech/ams/model/UserMapping.java

@ -3,6 +3,7 @@ package com.jiagutech.ams.model;
import com.jiagutech.ams.model.dto.UserDTO; import com.jiagutech.ams.model.dto.UserDTO;
import com.jiagutech.ams.model.request.UserRequest; import com.jiagutech.ams.model.request.UserRequest;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
/** /**
@ -17,6 +18,7 @@ public interface UserMapping {
UserMapping INSTANCE = Mappers.getMapper(UserMapping.class); UserMapping INSTANCE = Mappers.getMapper(UserMapping.class);
@Mapping(source = "userId", target = "id")
UserDTO userToUserDTO(UserRequest user); UserDTO userToUserDTO(UserRequest user);
LoginUser userDTOToLoginUser(UserDTO userDTO); LoginUser userDTOToLoginUser(UserDTO userDTO);

1
system/src/main/java/com/jiagutech/ams/model/request/UserRequest.java

@ -20,7 +20,6 @@ public class UserRequest {
/** /**
* 用户ID * 用户ID
*/ */
@JsonIgnore
private Long userId; private Long userId;
/** /**

1
system/src/main/java/com/jiagutech/ams/service/UserServiceImpl.java

@ -94,6 +94,7 @@ public class UserServiceImpl implements UserService {
RegionVO completeRegionInfo = regionMapper.getCompleteRegionInfo(userDTO.getRegionCode()); RegionVO completeRegionInfo = regionMapper.getCompleteRegionInfo(userDTO.getRegionCode());
if (completeRegionInfo != null) { if (completeRegionInfo != null) {
userDTO.setRegionPath(completeRegionInfo.getRegionCode()); userDTO.setRegionPath(completeRegionInfo.getRegionCode());
userDTO.setRegionName(completeRegionInfo.getRegionName());
} }
} }
userMapper.insert(userDTO); userMapper.insert(userDTO);

58
web/pom.xml

@ -30,6 +30,13 @@
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
</profile> </profile>
<profile>
<id>zyg</id>
<properties>
<profiles.active>zyg</profiles.active>
<logging.level>info</logging.level>
</properties>
</profile>
<profile> <profile>
<id>prod</id> <id>prod</id>
<properties> <properties>
@ -81,9 +88,33 @@
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-redis</artifactId> <artifactId>sa-token-redis</artifactId>
</dependency> </dependency>
<!-- 添加 MapStruct 依赖 -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.5.3.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-amqp</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.yml</include>
<include>application-${profiles.active}.yml</include>
<include>*.xml</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -97,6 +128,31 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- 添加 MapStruct 插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.3.Final</version>
</path>
<!-- 添加 Lombok 注解处理器 -->
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

40
web/src/main/java/com/jiagutech/ams/common/RabbitConfig.java

@ -0,0 +1,40 @@
package com.jiagutech.ams.common;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ClassName RabbitConfig
* @author: zhangyeguang
* @create: 2024-09-10 09:58
* @Version 1.0
* @description:
**/
@Configuration
public class RabbitConfig {
public static final String EXCHANGE_NAME = "topic.exchange";
public static final String QUEUE_FARM_SORTIE = "queue_amssortie_social";
@Bean
public Exchange exchange() {
//durable(true) 持久化,mq重启之后交换机还在
return ExchangeBuilder.topicExchange(EXCHANGE_NAME).durable(true).build();
}
@Bean(QUEUE_FARM_SORTIE)
public Queue farmsortieQueue() {
return new Queue(QUEUE_FARM_SORTIE);
}
@Bean
public Binding bindingFarmSortie() {
return BindingBuilder.bind(farmsortieQueue()).to(exchange()).with("#.farmsortie").noargs();
}
}

27
web/src/main/resources/application-dev.yml

@ -0,0 +1,27 @@
spring:
datasource:
# url: jdbc:mysql://192.168.10.111:23306/ams_social?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
# username: root
# password: 123456
url: jdbc:mysql://101.34.243.138:7306/ams_social?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
username: ams
password: ams@1234
data:
redis:
host: 192.168.10.111
port: 6379
database: 10
rabbitmq:
host: 192.168.10.111
port: 5672
username: admin
password: admin
center-track:
client:
url: http://localhost:11003/iot/farm/track

26
web/src/main/resources/application-zyg.yml

@ -0,0 +1,26 @@
spring:
datasource:
url: jdbc:mysql://101.34.243.138:7306/ams_social?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
username: ams
password: ams@1234
data:
redis:
host: 101.34.243.138
port: 7379
database: 10
# password: 123456
rabbitmq:
host: 192.168.10.111
port: 5672
username: admin
password: admin
center-track:
client:
url: http://localhost:8080/iot/mTrack

38
web/src/main/resources/application.yml

@ -1,19 +1,14 @@
server: server:
port: 8180
port: 8181
spring: spring:
profiles:
active: @profiles.active@
application: application:
name: ams-social name: ams-social
datasource: datasource:
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://192.168.10.111:23306/ams_social?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
# username: root
# password: 123456
url: jdbc:mysql://101.34.243.138:7306/ams_social?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
username: ams
password: ams@1234
hikari: hikari:
# 最大连接池数量 # 最大连接池数量
maxPoolSize: 20 maxPoolSize: 20
@ -31,25 +26,24 @@ spring:
keepaliveTime: 30000 keepaliveTime: 30000
data: data:
redis: redis:
host: 192.168.10.111
port: 6379
database: 10
# host: 101.34.243.138
# port: 7379
# database: 10
# # password: 123456
timeout: 10s timeout: 10s
# password: tent_zyg@1234
lettuce: lettuce:
pool: pool:
# 连接池最大连接数 # 连接池最大连接数
max-active: 200
max-active: 100
# 连接池最大阻塞等待时间(使用负值表示没有限制) # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: 3000ms max-wait: 3000ms
# 连接池中的最大空闲连接 # 连接池中的最大空闲连接
max-idle: 100
max-idle: 50
# 连接池中的最小空闲连接 # 连接池中的最小空闲连接
min-idle: 10 min-idle: 10
rabbitmq:
listener:
simple:
concurrency: 2
mybatis-plus: mybatis-plus:
@ -61,6 +55,7 @@ mybatis-plus:
global-config: global-config:
db-config: db-config:
id-type: assign_id id-type: assign_id
banner: false
sa-token: sa-token:
@ -73,7 +68,7 @@ sa-token:
is-share: false is-share: false
# jwt秘钥 # jwt秘钥
jwt-secret-key: abcdefghijklmnopqrstuvwxyz jwt-secret-key: abcdefghijklmnopqrstuvwxyz
is-print: true
is-print: false
is-log: false is-log: false
http: http:
@ -84,8 +79,11 @@ http:
read-timeout: 5000 read-timeout: 5000
logging: logging:
level: level:
root: INFO root: INFO
com.jiagutech.ams.mapper: DEBUG com.jiagutech.ams.mapper: DEBUG
springdoc:
api-docs:
enabled: true

Loading…
Cancel
Save