|
@@ -121,9 +121,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
}
|
|
|
Task task = new Task();
|
|
|
BeanUtils.copyProperties(taskDto,task);
|
|
|
- task.setCreateDate(new Date());//任务的创建时间
|
|
|
+ task.setCreateDate(LocalDateTime.now());//任务的创建时间
|
|
|
//根据任务的开始时间与当下时间判断任务的状态
|
|
|
- if (taskDto.getStartDate()==null||taskDto.getStartDate().after(new Date())){
|
|
|
+ if (taskDto.getStartDate()==null||taskDto.getStartDate().isAfter(LocalDateTime.now())){
|
|
|
task.setStatus(0);
|
|
|
}else {
|
|
|
task.setStatus(1);
|
|
@@ -397,7 +397,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
Task task=new Task();
|
|
|
task.setCompanyId(companyId);
|
|
|
task.setCreaterId(user.getId());
|
|
|
- task.setCreateDate(new Date());
|
|
|
+ task.setCreateDate(LocalDateTime.now());
|
|
|
for (int i = 0; i < cellNum; i++) {
|
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
|
String modelName = item.getString("model");
|
|
@@ -499,18 +499,34 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
if(modelName.equals("startDate")){
|
|
|
if(cell != null && cell.getCellTypeEnum() != CellType.BLANK){
|
|
|
if (cell.getCellTypeEnum() == CellType.NUMERIC){
|
|
|
- double numericCellValue = cell.getNumericCellValue();
|
|
|
- long daysSince1900 = (long) numericCellValue - 2;
|
|
|
- task.setStartDate(new Date(daysSince1900));
|
|
|
+ Date dateCellValue = cell.getDateCellValue();
|
|
|
+ if (dateCellValue.before(new Date(-2208988800L))){
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String string = format.format(dateCellValue);
|
|
|
+ System.out.println(string);
|
|
|
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime time = LocalDateTime.parse(string, dateTimeFormatter);
|
|
|
+ task.setStartDate(time);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(modelName.equals("endDate")){
|
|
|
if(cell != null && cell.getCellTypeEnum() != CellType.BLANK){
|
|
|
if (cell.getCellTypeEnum() == CellType.NUMERIC){
|
|
|
- double numericCellValue = cell.getNumericCellValue();
|
|
|
- long daysSince1900 = (long) numericCellValue - 2;
|
|
|
- task.setEndDate(new Date(daysSince1900));
|
|
|
+ Date dateCellValue = cell.getDateCellValue();
|
|
|
+ if (dateCellValue.before(new Date(-2208988800L))){
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String string = format.format(dateCellValue);
|
|
|
+ System.out.println(string);
|
|
|
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime time = LocalDateTime.parse(string, dateTimeFormatter);
|
|
|
+ task.setEndDate(time);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -771,14 +787,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
}
|
|
|
else if(model.equals("startDate")){
|
|
|
if (tasKVo.getStartDate()!=null){
|
|
|
- Date startDate = tasKVo.getStartDate();
|
|
|
+ LocalDateTime startDate = tasKVo.getStartDate();
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
value=format.format(startDate);
|
|
|
}
|
|
|
}
|
|
|
else if(model.equals("endDate")){
|
|
|
if (tasKVo.getEndDate()!=null){
|
|
|
- Date endDate = tasKVo.getEndDate();
|
|
|
+ LocalDateTime endDate = tasKVo.getEndDate();
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
value=format.format(endDate);
|
|
|
}
|