|
|
@@ -37,8 +37,14 @@ import javax.validation.Valid;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.ParsePosition;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.ZoneId;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -239,8 +245,11 @@ public class TextbookController {
|
|
|
@PostMapping
|
|
|
@ApiOperation(value = "新增教材管理")
|
|
|
@SaCheckPermission("textbook:add")
|
|
|
- public RT<Boolean> add(@Valid @RequestBody AddTextbookDto dto){
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddTextbookDto dto) throws ParseException {
|
|
|
+ String publishingDateStr = dto.getPublishingDate();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
|
+ textbook.setPublishingDate(sdf.parse(publishingDateStr));
|
|
|
boolean isSuccess = textbookService.add(textbook);
|
|
|
return RT.ok(isSuccess);
|
|
|
}
|
|
|
@@ -248,9 +257,11 @@ public class TextbookController {
|
|
|
@PutMapping
|
|
|
@ApiOperation(value = "修改教材管理")
|
|
|
@SaCheckPermission("textbook:edit")
|
|
|
- public RT<Boolean> update(@Valid @RequestBody UpdateTextbookDto dto){
|
|
|
-
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateTextbookDto dto) throws ParseException {
|
|
|
+ String publishingDateStr = dto.getPublishingDate();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
|
|
|
+ textbook.setPublishingDate(sdf.parse(publishingDateStr ));
|
|
|
return RT.ok(textbookService.update(textbook));
|
|
|
|
|
|
}
|