wanjing пре 1 година
родитељ
комит
27a5b1055c
3 измењених фајлова са 17 додато и 4 уклоњено
  1. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLAirportFlightDataResponse.java
  2. +7
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLFlyDataServiceTest.java

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/response/TZHLAirportFlightDataResponse.java Прегледај датотеку

@@ -1,6 +1,8 @@
package com.tuoheng.admin.tzhl.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
* @Author ChengWang
@@ -295,5 +297,12 @@ public class TZHLAirportFlightDataResponse{
*/
private String videoStreamSource;

/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String createTime;


}

+ 7
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java Прегледај датотеку

@@ -14,8 +14,6 @@ import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.response.TZHLAirportFlightDataResponse;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
import com.tuoheng.admin.tzhl.service.airport.TZHLGetAirportListService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.RedisUtils;
import com.tuoheng.common.core.utils.StringUtils;
@@ -24,6 +22,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
@@ -68,6 +67,7 @@ public class FlyDataService {
*/
private void addFlightDataHl(Inspection inspection, List<TZHLAirportFlightDataResponse> flightDataHlList) {
log.info("开始飞行数据保存入库");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(CollectionUtil.isNotEmpty(flightDataHlList) && flightDataHlList.size() != 0){
List<FlightDataHl> flightDataHls = new ArrayList<>(flightDataHlList.size());
for (TZHLAirportFlightDataResponse responseData : flightDataHlList) {
@@ -75,7 +75,11 @@ public class FlyDataService {
BeanUtils.copyProperties(responseData,flightDataHl);
flightDataHl.setTenantId(inspection.getTenantId());
flightDataHl.setInspectionId(inspection.getId());
flightDataHl.setCreateTime(DateUtils.now());
try {
flightDataHl.setCreateTime(sdf.parse(responseData.getCreateTime()));
} catch (ParseException e) {
e.printStackTrace();
}
flightDataHl.setCreateUser(inspection.getCreateUser());

int count = flightDataHlMapper.insert(flightDataHl);

+ 1
- 1
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLFlyDataServiceTest.java Прегледај датотеку

@@ -24,7 +24,7 @@ public class TZHLFlyDataServiceTest {

@Test
public void testFlyData() {
String id = "d51d654e4b8aae6533cbdd997af100d9";
String id = "8ff6481ce78ad2a1315e85332c33b9c2";
Inspection inspection = inspectionMapper.selectById(id);
flyDataService.getFlyData(inspection);
}

Loading…
Откажи
Сачувај