Commit 7caf606b by 向延琳

常驻地列表

1 parent b52988c2
......@@ -41,4 +41,30 @@ public final class ConstantsVehicle {
}
/**
* 常驻地查询时间范围;1:一个月 2:三个月 3:半年内 4:截至到目前,5:自定义,-1测试用
*/
public static final String RESIDENT_TYPE_ONE = "1";
/**
* 常驻地查询时间范围; 2:三个月
*/
public static final String RESIDENT_TYPE_THREE = "2";
/**
* 常驻地查询时间范围; 3:半年内
*/
public static final String RESIDENT_TYPE_SIX = "3";
/**
* 常驻地查询时间范围; 4:截至到目前
*/
public static final String RESIDENT_TYPE_PRESENT = "4";
/**
* 常驻地查询时间范围;,5:自定义
*/
public static final String RESIDENT_TYPE_CUSTOM = "5";
}
......@@ -161,9 +161,9 @@ public class VehicleMonitorController {
@ApiResponse(code = 200,message = "OK",response = ResidentListVO.class),
})
@GetMapping("/residentList")
public R<List<ResidentListVO>> queryResidentList(ResidentSearch search){
ResidentListVO element = new ResidentListVO();
return R.ok().data(Lists.newArrayList(element));
public R<List<ResidentListVO>> queryResidentList(ResidentSearch search) {
List<ResidentListVO> residentList = vehicleMonitorService.queryResidentList(search);
return R.ok().data(residentList);
}
/**
......
package cn.com.glsx.admin.modules.converter;
import cn.com.glsx.admin.modules.entity.VehicleDeviceWorkOrder;
import cn.com.glsx.admin.modules.model.export.StayPointListExport;
import cn.com.glsx.admin.modules.model.param.ResidentSearch;
import cn.com.glsx.admin.modules.model.param.StayPointSearch;
import cn.com.glsx.admin.modules.model.vo.ResidentListVO;
import cn.com.glsx.admin.modules.model.vo.StayPointListVO;
import cn.com.glsx.admin.modules.utils.DateUtil;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import java.util.Optional;
/**
* @author xiangyanlin
* @date 2022/5/10
*/
public class WorkOrderVehicleConvert {
public static StayPointListVO buildStayPointListVO(StayPointRecordDTO stayPointRecordDTO,
VehicleDeviceWorkOrder vehicleDeviceWorkOrder,
String sn) {
StayPointListVO stayPointListVO = new StayPointListVO();
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
.ifPresent(stayPointListVO::setWorkOrderNo);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getOwnerName)
.ifPresent(stayPointListVO::setOwnerName);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getOwnerName)
.ifPresent(stayPointListVO::setOwnerName);
stayPointListVO.setSn(sn);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getVin)
.ifPresent(stayPointListVO::setVin);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getShopName)
.ifPresent(stayPointListVO::setShopName);
stayPointListVO.setBeginTime(stayPointRecordDTO.getBeginTime());
stayPointListVO.setEndTime(stayPointRecordDTO.getEndTime());
//时长
Optional.ofNullable(stayPointRecordDTO.getDuration())
.map(e -> e * 1000)
.map(Integer::longValue)
.map(DateUtil::normalFormatDuration)
.ifPresent(stayPointListVO::setDuration);
stayPointListVO.setLocationType("GPS");
Optional.ofNullable(stayPointRecordDTO)
.map(StayPointRecordDTO::getStayGps)
.map(GpsLocation::getElat)
.ifPresent(stayPointListVO::setElat);
Optional.ofNullable(stayPointRecordDTO)
.map(StayPointRecordDTO::getStayGps)
.map(GpsLocation::getElng)
.ifPresent(stayPointListVO::setElng);
return stayPointListVO;
}
public static StayPointListExport buildStayPointListExport(StayPointRecordDTO stayPointRecordDTO,
VehicleDeviceWorkOrder vehicleDeviceWorkOrder,
String sn, String address) {
StayPointListExport stayPointListExport = new StayPointListExport();
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
.ifPresent(stayPointListExport::setWorkOrderNo);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getOwnerName)
.ifPresent(stayPointListExport::setOwnerName);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getOwnerName)
.ifPresent(stayPointListExport::setOwnerName);
stayPointListExport.setSn(sn);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getVin)
.ifPresent(stayPointListExport::setVin);
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getShopName)
.ifPresent(stayPointListExport::setShopName);
stayPointListExport.setBeginTime(stayPointRecordDTO.getBeginTime());
stayPointListExport.setEndTime(stayPointRecordDTO.getEndTime());
//时长
Optional.ofNullable(stayPointRecordDTO.getDuration())
.map(e -> e * 1000)
.map(Integer::longValue)
.map(DateUtil::normalFormatDuration)
.ifPresent(stayPointListExport::setDuration);
stayPointListExport.setLocationType("GPS");
stayPointListExport.setAddress(address);
return stayPointListExport;
}
public static StayPointRequest buildStayPointRequest(StayPointSearch search) {
StayPointRequest request = new StayPointRequest();
request.setSn(search.getSn());
request.setPeriodType(search.getTimes());
request.setBeginTime(DateUtil.parseDateYmd(search.getStartTime()));
request.setEndTime(DateUtil.parseDateYmd(search.getEndTime()));
request.setMax(search.getMaxTime());
request.setMin(search.getMinTime());
return request;
}
public static ResidentRequest buildResidentRequest(ResidentSearch search, String beginTime, String endTime,
Integer locInfoType) {
ResidentRequest residentRequest = new ResidentRequest();
residentRequest.setSn(search.getSn());
residentRequest.setBeginTime(beginTime);
residentRequest.setEndTime(endTime);
residentRequest.setTimes(search.getTimes());
residentRequest.setLocInfoType(locInfoType);
return residentRequest;
}
public static ResidentListVO buildResidentListVO(ResidentDTO residentDTO, VehicleDeviceWorkOrder common) {
ResidentListVO residentListVO = new ResidentListVO();
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
.ifPresent(residentListVO::setWorkOrderNo);
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getOwnerName)
.ifPresent(residentListVO::setOwnerName);
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getSn)
.ifPresent(residentListVO::setSn);
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getVin)
.ifPresent(residentListVO::setVin);
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getShopName)
.ifPresent(residentListVO::setShopName);
Optional.ofNullable(residentDTO.getTotalDuration())
.map(e -> e * 1000)
.map(Integer::longValue)
.map(DateUtil::normalFormatDuration)
.ifPresent(residentListVO::setTotalDurationString);
residentListVO.setTotalTimes(residentDTO.getTotalTimes());
residentListVO.setLongitude(residentDTO.getLongitude());
residentListVO.setLatitude(residentDTO.getLatitude());
residentListVO.setBlat(residentDTO.getBlat());
residentListVO.setBlng(residentDTO.getBlng());
residentListVO.setElat(residentDTO.getElat());
residentListVO.setElng(residentDTO.getElng());
return residentListVO;
}
}
......@@ -29,6 +29,18 @@ public class ResidentSearch implements Serializable {
private String sn;
/**
* 开始时间
*/
@ApiModelProperty(value = "开始时间")
private String startTime;
/**
* 截止时间
*/
@ApiModelProperty(value = "截止时间")
private String endTime;
/**
* 时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天
*/
@ApiModelProperty(value = "时段 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)0:全天")
......
......@@ -64,7 +64,7 @@ public class ResidentListVO implements Serializable {
* 经度
*/
@ApiModelProperty(value = "经度")
private String lng;
private String longitude;
/**
* 纬度
......
package cn.com.glsx.admin.modules.remote;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.api.feign.ResidentFeignService;
import com.glsx.plat.core.web.R;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 常驻地服务
* @author xiangyanlin
* @date 2022/5/10
*/
@Slf4j
@Service
public class RemoteFeignResidentService {
@Autowired
private ResidentFeignService residentFeignService;
public List<ResidentDTO> getResidentList(ResidentRequest request) {
R<List<ResidentDTO>> residentList = residentFeignService.getResidentList(request);
return residentList.getDataList(new TypeToken<List<ResidentDTO>>() {
}.getType());
}
}
......@@ -10,6 +10,8 @@ import org.eclipse.jetty.util.StringUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -1526,6 +1528,15 @@ public class DateUtil extends org.apache.commons.lang.time.DateUtils {
return DurationFormatUtils.formatDuration(timestamp, "HH 时 mm 分 ss 秒");
}
/**
* 获取当前时间
* @return yyyy-MM-dd HH:mm:ss
*/
public static String getNowDateTimeFormat() {
LocalDateTime now = LocalDateTime.now();
return now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
public static void main(String[] args) {
// System.out.println(formatDate(getStartDateOfCurrentDay(new Date())));
System.out.println(getMaxDayOfCurrentMonth());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!