狩猎人员时间字段处理

develop
hanrenchun 10 months ago
parent 0b1582ec62
commit b7a821c680

@ -24,7 +24,10 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -49,6 +52,8 @@ public class TransitHuntersUserModelRecordController extends BaseController {
QueryWrapper<TransitHuntersUserModelRecord> queryWrapper = new QueryWrapper<>(transitHuntersUserModelRecord); QueryWrapper<TransitHuntersUserModelRecord> queryWrapper = new QueryWrapper<>(transitHuntersUserModelRecord);
SimpleDateFormat outputSdf = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (transitHuntersUserModelRecord.getFirstTime() != null && transitHuntersUserModelRecord.getEndTime() != null) { if (transitHuntersUserModelRecord.getFirstTime() != null && transitHuntersUserModelRecord.getEndTime() != null) {
queryWrapper.between("partition_field", transitHuntersUserModelRecord.getFirstTime(), transitHuntersUserModelRecord.getEndTime()); queryWrapper.between("partition_field", transitHuntersUserModelRecord.getFirstTime(), transitHuntersUserModelRecord.getEndTime());
} }
@ -57,6 +62,15 @@ public class TransitHuntersUserModelRecordController extends BaseController {
.map(record -> { .map(record -> {
TransitHuntersUserModelRecordVo modelRecordVo = new TransitHuntersUserModelRecordVo(); TransitHuntersUserModelRecordVo modelRecordVo = new TransitHuntersUserModelRecordVo();
BeanUtils.copyProperties(record,modelRecordVo); BeanUtils.copyProperties(record,modelRecordVo);
String warningTime = modelRecordVo.getWarningTime();
Date parse = null;
try {
parse = outputSdf.parse(warningTime);
} catch (ParseException e) {
e.printStackTrace();
}
String format = dateFormat.format(parse);
modelRecordVo.setWarningTime(format);
Long firstTime = modelRecordVo.getFirstPassTime(); Long firstTime = modelRecordVo.getFirstPassTime();
Long endTime = modelRecordVo.getEndPassTime(); Long endTime = modelRecordVo.getEndPassTime();
if( !"".equals(StringKit.toString(firstTime)) && !"".equals(StringKit.toString(endTime)) ){ if( !"".equals(StringKit.toString(firstTime)) && !"".equals(StringKit.toString(endTime)) ){

Loading…
Cancel
Save