Browse Source

教材模块重构-教材基本信息,教材征订

大数据与最优化研究所 2 months ago
parent
commit
6833271caa
35 changed files with 2111 additions and 968 deletions
  1. 4 1
      src/main/java/com/xjrsoft/module/base/controller/BaseClassCourseController.java
  2. 0 42
      src/main/java/com/xjrsoft/module/base/vo/BaseClassCoursePageVo.java
  3. 24 47
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java
  4. 7 7
      src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionController.java
  5. 54 77
      src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookDto.java
  6. 48 0
      src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionClassDto.java
  7. 64 0
      src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionDto.java
  8. 78 0
      src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionItemDto.java
  9. 74 46
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookImportDto.java
  10. 116 0
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookListDto.java
  11. 98 26
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookPageDto.java
  12. 2 1
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookSubscriptionListDto.java
  13. 12 3
      src/main/java/com/xjrsoft/module/textbook/dto/UpdateTextbookDto.java
  14. 54 85
      src/main/java/com/xjrsoft/module/textbook/entity/Textbook.java
  15. 115 0
      src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscription.java
  16. 98 0
      src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscriptionClass.java
  17. 128 0
      src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscriptionItem.java
  18. 17 0
      src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionClassMapper.java
  19. 17 0
      src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionItemMapper.java
  20. 17 0
      src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionMapper.java
  21. 16 12
      src/main/java/com/xjrsoft/module/textbook/service/ITextbookService.java
  22. 7 6
      src/main/java/com/xjrsoft/module/textbook/service/IWfTextbookSubscriptionService.java
  23. 319 264
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java
  24. 0 5
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookClaimServiceImpl.java
  25. 2 2
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookRecedeServiceImpl.java
  26. 36 41
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java
  27. 139 0
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookListVo.java
  28. 83 129
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookPageVo.java
  29. 2 2
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionListVo.java
  30. 56 10
      src/main/java/com/xjrsoft/module/veb/controller/ImportRubAndHandController.java
  31. 2 0
      src/main/java/com/xjrsoft/module/veb/service/ImportRubAndHandService.java
  32. 144 5
      src/main/java/com/xjrsoft/module/veb/service/impl/ImportRubAndHandServiceImpl.java
  33. 195 133
      src/main/resources/sqlScript/textbook_sql.sql
  34. 78 19
      src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java
  35. 5 5
      src/test/java/com/xjrsoft/xjrsoftboot/TextBookTest.java

+ 4 - 1
src/main/java/com/xjrsoft/module/base/controller/BaseClassCourseController.java

@@ -7,6 +7,7 @@ import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -95,9 +96,10 @@ public class BaseClassCourseController {
     @GetMapping(value = "/list")
     @ApiOperation(value = "单个班级班级课程列表")
     @SaCheckPermission("baseclasscourse:detail")
-    public RT<List<BaseClassCourseListVo>> page(@Valid BaseClassCourseListDto dto) {
+    public RT<List<BaseClassCourseListVo>> list(@Valid BaseClassCourseListDto dto) {
         MPJLambdaWrapper<BaseClassCourse> baseClassCourseMPJLambdaWrapper = new MPJLambdaWrapper<>();
         baseClassCourseMPJLambdaWrapper
+                .disableSubLogicDel()
                 .select(BaseClassCourse::getCourseId)
                 .selectAs(BaseClass::getName, BaseClassCourseListVo::getClassIdCn)
                 .selectAs(BaseCourseSubject::getName, BaseClassCourseListVo::getCourseIdCn)
@@ -110,6 +112,7 @@ public class BaseClassCourseController {
                 .leftJoin(BaseSemester.class, BaseSemester::getId, BaseClassCourse::getBaseSemesterId)
                 .eq(dto.getBaseSemesterId() != null && dto.getBaseSemesterId() > 0, BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
                 .eq(dto.getClassId() != null && dto.getClassId() > 0, BaseClassCourse::getClassId, dto.getClassId())
+                .eq(BaseClassCourse::getDeleteMark, DeleteMark.NODELETE.getCode())
                 ;
         List<BaseClassCourseListVo> baseClassCourseListVoList = baseClassCourseService.selectJoinList(BaseClassCourseListVo.class, baseClassCourseMPJLambdaWrapper);
         return RT.ok(baseClassCourseListVoList);

+ 0 - 42
src/main/java/com/xjrsoft/module/base/vo/BaseClassCoursePageVo.java

@@ -23,48 +23,6 @@ public class BaseClassCoursePageVo {
     @ApiModelProperty("")
     private String id;
     /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Long createUserId;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Date createDate;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Long modifyUserId;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Date modifyDate;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Integer deleteMark;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Integer enabledMark;
-    /**
-    * 
-    */
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("")
-    private Integer sortCode;
-    /**
     * 班级id(base_class)
     */
     @ContentStyle(dataFormat = 49)

+ 24 - 47
src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java

@@ -5,17 +5,14 @@ import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.TextbookTypeEnum;
-import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
 import com.xjrsoft.module.student.entity.BaseClassMajorSet;
-import com.xjrsoft.module.student.service.IBaseClassMajorSetService;
 import com.xjrsoft.module.textbook.dto.*;
 import com.xjrsoft.module.textbook.entity.Textbook;
 import com.xjrsoft.module.textbook.entity.TextbookClassRelation;
@@ -28,14 +25,10 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -56,13 +49,11 @@ public class TextbookController {
 
     private final ITextbookStudentClaimService textbookStudentClaimService;
 
-    private final IBaseClassMajorSetService baseClassMajorSetService;
-
     @GetMapping(value = "/page")
     @ApiOperation(value="教材管理列表(分页)")
     @SaCheckPermission("textbook:detail")
     public RT<PageOutput<TextbookPageVo>> page(@Valid TextbookPageDto dto){
-        Page<TextbookPageVo> page = textbookService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        IPage<TextbookPageVo> page = textbookService.pageRubAndHand(dto);
         PageOutput<TextbookPageVo> pageOutput = ConventPage.getPageOutput(page, TextbookPageVo.class);
         return RT.ok(pageOutput);
     }
@@ -93,7 +84,7 @@ public class TextbookController {
         ;
         IPage<TextbookConsumptionPageVo> page = textbookStudentClaimService.selectJoinListPage(ConventPage.getPage(dto),TextbookConsumptionPageVo.class,textbookMPJLambdaWrapper);
         for(TextbookConsumptionPageVo t : page.getRecords()){
-            if(t.getTextbookType() != null && !t.getTextbookType().equals("")){
+            if((t.getTextbookType() != null) && !t.getTextbookType().isEmpty()){
                 t.setTextbookTypeCn(TextbookTypeEnum.getValue(t.getTextbookType()));
             }
         }
@@ -106,7 +97,7 @@ public class TextbookController {
     @SaCheckPermission("textbook:detail")
     public RT<List<TextbookSubscriptionListVo>> listSubscription(@Valid TextbookSubscriptionListDto dto){
         List<String> classIdList = new ArrayList<>();
-        if(dto.getClassIds() != null && !dto.getClassIds().equals("")){
+        if(dto.getClassIds() != null && !dto.getClassIds().isEmpty()){
             String[] classIdArr =  dto.getClassIds().split(",");
             classIdList = Arrays.asList(classIdArr);
         }
@@ -131,12 +122,11 @@ public class TextbookController {
     @GetMapping(value = "/info-detail")
     @ApiOperation(value="根据id查询教材管理信息")
     @SaCheckPermission("textbook:detail")
-    public RT info(@RequestParam Long id){
+    public RT<TextbookVo> info(@RequestParam Long id){
         Textbook textbook = textbookService.getById(id);
         if (textbook == null) {
-           return RT.ok();
+           return RT.ok(new TextbookVo());
         }
-        textbook.setTextbookClassRelationList(textbookService.getClassRelation(textbook.getId()));
         return RT.ok(BeanUtil.toBean(textbook, TextbookVo.class));
     }
 
@@ -145,9 +135,6 @@ public class TextbookController {
     @SaCheckPermission("textbook:detail")
     public RT<TextbookVo> infoByissn(@RequestParam String issn){
         TextbookVo textbook = textbookService.getInfoByissn(issn);
-        if (textbook == null) {
-            return RT.ok();
-        }
         return RT.ok(textbook);
     }
 
@@ -199,14 +186,8 @@ public class TextbookController {
     @ApiOperation(value = "新增教材管理")
     @SaCheckPermission("textbook:add")
     public RT<Boolean> add(@Valid @RequestBody AddTextbookDto dto) throws ParseException {
-        String publishingDateStr = dto.getPublishingDate();
         Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
-        if(publishingDateStr != null && !"".equals(publishingDateStr)){
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-            textbook.setPublishingDate(sdf.parse(publishingDateStr));
-        }
-
-        boolean isSuccess = textbookService.add(textbook);
+        boolean isSuccess = textbookService.addRubAndHand(textbook);
         return RT.ok(isSuccess);
     }
 
@@ -214,13 +195,8 @@ public class TextbookController {
     @ApiOperation(value = "修改教材管理")
     @SaCheckPermission("textbook:edit")
     public RT<Boolean> update(@Valid @RequestBody UpdateTextbookDto dto) throws ParseException {
-        String publishingDateStr = dto.getPublishingDate();
         Textbook textbook = BeanUtil.toBean(dto, Textbook.class);
-        if(publishingDateStr != null && !"".equals(publishingDateStr)){
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-            textbook.setPublishingDate(sdf.parse(publishingDateStr));
-        }
-        return RT.ok(textbookService.update(textbook));
+        return RT.ok(textbookService.updateRubAndHand(textbook));
 
     }
 
@@ -231,15 +207,15 @@ public class TextbookController {
         return RT.ok(textbookService.delete(ids));
     }
 
-    @GetMapping("/export")
-    @ApiOperation(value = "导出")
-    public ResponseEntity<byte[]> exportData(@Valid TextbookPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
-        List<TextbookPageVo> customerList = isTemplate != null && isTemplate ? new ArrayList<>() : ((PageOutput<TextbookPageVo>) page(dto).getData()).getList();
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, TextbookPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
-
-        return RT.fileStream(bot.toByteArray(), "Textbook" + ExcelTypeEnum.XLSX.getValue());
-    }
+//    @GetMapping("/export")
+//    @ApiOperation(value = "导出")
+//    public ResponseEntity<byte[]> exportData(@Valid TextbookPageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
+//        List<TextbookPageVo> customerList = isTemplate != null && isTemplate ? new ArrayList<>() : ((PageOutput<TextbookPageVo>) page(dto).getData()).getList();
+//        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+//        EasyExcel.write(bot, TextbookPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
+//
+//        return RT.fileStream(bot.toByteArray(), "Textbook" + ExcelTypeEnum.XLSX.getValue());
+//    }
 
     @PostMapping("deliver-warehouse")
     @ApiOperation(value = "教材管理入库")
@@ -283,11 +259,12 @@ public class TextbookController {
         return RT.fileStream(bot.toByteArray(), "TextbookClaim" + ExcelTypeEnum.XLSX.getValue());
     }
 
-    @PostMapping("/excel-import")
-    @ApiOperation(value = "excel教材导入")
-    @SaCheckPermission("coursetable:excelimport")
-    public R excelImport( @RequestParam("file") MultipartFile file) throws IOException {
-        InputStream inputStream = file.getInputStream();
-        return R.ok(textbookService.excelImport(inputStream));
-    }
+//    @PostMapping("/excel-import")
+//    @ApiOperation(value = "excel教材导入")
+//    @SaCheckPermission("coursetable:excelimport")
+//    public R excelImport( @RequestParam("file") MultipartFile file) throws IOException {
+//        InputStream inputStream = file.getInputStream();
+//        return R.ok(textbookService.excelImport(inputStream));
+//    }
+
 }

+ 7 - 7
src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionController.java

@@ -18,6 +18,7 @@ import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.student.entity.BaseClassMajorSet;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.*;
+import com.xjrsoft.module.textbook.entity.TextbookSubscription;
 import com.xjrsoft.module.textbook.entity.WfTextbookSubscription;
 import com.xjrsoft.module.textbook.entity.WfTextbookSubscriptionItem;
 import com.xjrsoft.module.textbook.service.IWfTextbookSubscriptionService;
@@ -192,14 +193,13 @@ public class WfTextbookSubscriptionController {
         return RT.ok(wfTextbookSubscriptionVo);
     }
 
-
     @PostMapping
-    @ApiOperation(value = "新增教材教辅征订")
-    @SaCheckPermission("wftextbooksubscription:add")
-    public RT<Boolean> add(@Valid @RequestBody AddWfTextbookSubscriptionDto dto){
-        WfTextbookSubscription wfTextbookSubscription = BeanUtil.toBean(dto, WfTextbookSubscription.class);
-        boolean isSuccess = wfTextbookSubscriptionService.add(wfTextbookSubscription);
-    return RT.ok(isSuccess);
+    @ApiOperation(value = "新增教材教辅征订记录表")
+    @SaCheckPermission("textbooksubscription:add")
+    public RT<Boolean> add(@Valid @RequestBody AddTextbookSubscriptionDto dto){
+        TextbookSubscription textbookSubscription = BeanUtil.toBean(dto, TextbookSubscription.class);
+        boolean isSuccess = wfTextbookSubscriptionService.add(textbookSubscription);
+        return RT.ok(isSuccess);
     }
 
     @PutMapping

+ 54 - 77
src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookDto.java

@@ -2,19 +2,22 @@ package com.xjrsoft.module.textbook.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
 import java.io.Serializable;
-import java.math.BigDecimal;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.time.LocalDate;
-import java.util.Date;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Date;
+
 
 
 /**
-* @title: 教材管理
-* @Author szs
-* @Date: 2023-12-25
+* @title: 教材基础信息表
+* @Author dzx
+* @Date: 2024-12-13
 * @Version 1.0
 */
 @Data
@@ -28,6 +31,21 @@ public class AddTextbookDto implements Serializable {
     @ApiModelProperty("序号")
     private Integer sortCode;
     /**
+    * 学科组管理编号(subject_group)
+    */
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private Long subjectGroupId;
+    /**
+    * 课程编号(base_course_subject)
+    */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private Long courseSubjectId;
+    /**
+    * 使用类型(单位:学期)
+    */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
     * 国际标准刊号
     */
     @ApiModelProperty("国际标准刊号")
@@ -53,21 +71,6 @@ public class AddTextbookDto implements Serializable {
     @ApiModelProperty("主编")
     private String editorInChief;
     /**
-    * 学科组管理编号(subject_group)
-    */
-    @ApiModelProperty("学科组管理编号(subject_group)")
-    private Long subjectGroupId;
-    /**
-    * 学期ID(base_semester)
-    */
-    @ApiModelProperty("学期ID(base_semester)")
-    private Long baseSemesterId;
-    /**
-    * 课程编号(base_course_subject)
-    */
-    @ApiModelProperty("课程编号(base_course_subject)")
-    private Long courseSubjectId;
-    /**
     * 版本
     */
     @ApiModelProperty("版本")
@@ -75,12 +78,12 @@ public class AddTextbookDto implements Serializable {
     /**
     * 是否为规划教材(xjr_dictionary_item[judgment_method_1])
     */
-    @ApiModelProperty("是否为规划教材(xjr_dictionary_item[judgment_method_1])")
-    private String isTextbookPlan;
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
     /**
-    * 教材类(xjr_dictionary_item[textbook_type])
+    * 教材类(xjr_dictionary_item[textbook_type])
     */
-    @ApiModelProperty("教材类(xjr_dictionary_item[textbook_type])")
+    @ApiModelProperty("教材类(xjr_dictionary_item[textbook_type])")
     private String textbookType;
     /**
     * 规格型号
@@ -88,70 +91,44 @@ public class AddTextbookDto implements Serializable {
     @ApiModelProperty("规格型号")
     private String specificationsModels;
     /**
-    * 估价(元)
+    * 出版日期
     */
-    @ApiModelProperty("估价(元)")
-    private BigDecimal appraisalPrice;
+    @ApiModelProperty("出版日期")
+    private LocalDate publishingDate;
     /**
-    * 定价(元)
+    * 是否校企合作开发教材
     */
-    @ApiModelProperty("定价(元)")
-    private BigDecimal price;
+    @ApiModelProperty("是否校企合作开发教材")
+    private Integer isSecd;
     /**
-    * 折扣
+    * 分类号
     */
-    @ApiModelProperty("折扣")
-    private Double discount;
+    @ApiModelProperty("分类号")
+    private String category;
     /**
-    * 小计(元)
+    * 规划批次
     */
-    @ApiModelProperty("小计(元)")
-    private BigDecimal subtotal;
+    @ApiModelProperty("规划批次")
+    private String planBatch;
     /**
-    * 库存
+    * 编著作总数
     */
-    @ApiModelProperty("库存")
-    private Integer stock;
-
-    /**
-     * 入学年级(base_grade)
-     */
-    @ApiModelProperty("入学年级(base_grade)")
-    private Long gradeId;
-
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
     /**
-    * textbookClassRelation
+    * 教材类型
     */
-    @ApiModelProperty("textbookClassRelation子表")
-    private List<AddTextbookClassRelationDto> textbookClassRelationList;
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
     /**
-    * textbookSubscriptionRecord
+    * 定价(元)
     */
-    @ApiModelProperty("textbookSubscriptionRecord子表")
-    private List<AddTextbookSubscriptionRecordDto> textbookSubscriptionRecordList;
-
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
     /**
-     * 使用类型(单位:学期)
-     */
-    @ApiModelProperty("使用类型(单位:学期)")
-    private Integer useType;
-
-    @ApiModelProperty("是否校企合作开发教材")
-    private Integer isSecd;
-
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @ApiModelProperty("出版日期")
-    private String publishingDate;
-
-    @ApiModelProperty("分类号")
-    private String category;
-
-    @ApiModelProperty("规划批次")
-    private String planBatch;
-
-    @ApiModelProperty("编著作总数")
-    private Integer workTotalCount;
+    * 预估折扣
+    */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
 
-    @ApiModelProperty("教材类型")
-    private String textbookCategory;
 }

+ 48 - 0
src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionClassDto.java

@@ -0,0 +1,48 @@
+package com.xjrsoft.module.textbook.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 教材征订记录与班级关联表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+public class AddTextbookSubscriptionClassDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+    /**
+    * 教材征订记录表id(textbook_subscription)
+    */
+    @ApiModelProperty("教材征订记录表id(textbook_subscription)")
+    private Long textbookSubscriptionId;
+    /**
+    * 按班级征订中征订的班级主键(base_class)
+    */
+    @ApiModelProperty("按班级征订中征订的班级主键(base_class)")
+    private Long baseClassId;
+
+}

+ 64 - 0
src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionDto.java

@@ -0,0 +1,64 @@
+package com.xjrsoft.module.textbook.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.textbook.entity.TextbookSubscriptionItem;
+
+
+
+/**
+* @title: 教材教辅征订记录表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+public class AddTextbookSubscriptionDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+    /**
+    * 学期id(base_semester)
+    */
+    @ApiModelProperty("学期id(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 征订方式(1:按班级征订 2:按教材征订)
+    */
+    @ApiModelProperty("征订方式(1:按班级征订 2:按教材征订)")
+    private Integer subscriptionMethod;
+    /**
+    * 征订教材总数
+    */
+    @ApiModelProperty("征订教材总数")
+    private Integer sum;
+    /**
+    * 征订状态(0:待发起,1:证订中,2:完成)
+    */
+    @ApiModelProperty("征订状态(0:待发起,1:证订中,2:完成)")
+    private Integer status;
+
+    /**
+    * textbookSubscriptionItem
+    */
+    @ApiModelProperty("textbookSubscriptionItem子表")
+    private List<AddTextbookSubscriptionItemDto> textbookSubscriptionItemList;
+}

+ 78 - 0
src/main/java/com/xjrsoft/module/textbook/dto/AddTextbookSubscriptionItemDto.java

@@ -0,0 +1,78 @@
+package com.xjrsoft.module.textbook.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 教材征订记录详情表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+public class AddTextbookSubscriptionItemDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 教材教辅增订记录表主键(textbook_subscription)
+    */
+    @ApiModelProperty("教材教辅增订记录表主键(textbook_subscription)")
+    private Long textbookSubscriptionId;
+    /**
+    * 教材表主键(textbook)
+    */
+    @ApiModelProperty("教材表主键(textbook)")
+    private Long textbookId;
+    /**
+    * 学生用书征订数量
+    */
+    @ApiModelProperty("学生用书征订数量")
+    private Integer studentNum;
+    /**
+    * 教师用书征订数量
+    */
+    @ApiModelProperty("教师用书征订数量")
+    private Integer teacherNum;
+    /**
+    * 实际折扣
+    */
+    @ApiModelProperty("实际折扣")
+    private Double discount;
+    /**
+    * 实际价格(元)
+    */
+    @ApiModelProperty("实际价格(元)")
+    private BigDecimal price;
+    /**
+    * 当前征订任务征订项入库数量
+    */
+    @ApiModelProperty("当前征订任务征订项入库数量")
+    private Integer inStockNum;
+    /**
+    * 当前征订任务征订项出库数量
+    */
+    @ApiModelProperty("当前征订任务征订项出库数量")
+    private Integer outStockNum;
+    /**
+    * 变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,)
+    */
+    @ApiModelProperty("变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,)")
+    private Integer alterationType;
+
+}

+ 74 - 46
src/main/java/com/xjrsoft/module/textbook/dto/TextbookImportDto.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.textbook.dto;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.xjrsoft.common.annotation.Required;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -10,12 +11,37 @@ import java.util.Date;
 
 @Data
 public class TextbookImportDto {
+    /**
+     * 学科组名称
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学科组(必须是系统中已有的学科组名称)")
+    @ApiModelProperty("学科组名称")
+    @Required
+    private String groupName;
+    /**
+     * 课程
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("对应课程(必须是系统中已有的课程名称)")
+    @ApiModelProperty("对应课程")
+    @Required
+    private String courseName;
+    /**
+     * 使用类型(单位:学期)
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("使用时长(一学期~六学期)")
+    @ApiModelProperty("使用类型(单位:学期)")
+    @Required
+    private String useTypeCn;
     /**
      * 国际标准刊号
      */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("书号(ISSN)")
     @ApiModelProperty("国际标准刊号")
+    @Required
     private String issn;
     /**
      * 书名
@@ -23,6 +49,7 @@ public class TextbookImportDto {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("书名")
     @ApiModelProperty("书名")
+    @Required
     private String bookName;
     /**
      * 出版社
@@ -30,6 +57,7 @@ public class TextbookImportDto {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("出版社")
     @ApiModelProperty("出版社")
+    @Required
     private String publishingHouse;
     /**
      * 主编
@@ -37,6 +65,7 @@ public class TextbookImportDto {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("作者(主编)")
     @ApiModelProperty("主编")
+    @Required
     private String editorInChief;
     /**
      * 版本
@@ -44,6 +73,7 @@ public class TextbookImportDto {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("版次")
     @ApiModelProperty("版本")
+    @Required
     private String version;
     /**
      * 是否为规划教材
@@ -51,82 +81,80 @@ public class TextbookImportDto {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("规划教材(是或否)")
     @ApiModelProperty("是否为规划教材")
+    @Required
     private String isTextbookPlanCn;
-    /**
-     * 使用类型(单位:学期)
-     */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用时长(一学期~六学期)")
-    @ApiModelProperty("使用类型(单位:学期)")
-    private String useTypeCn;
     /**
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("教材分类(教材、辅材、作业本)")
     @ApiModelProperty("教材类型-中文")
+    @Required
     private String textbookTypeCn;
     /**
-     * 定价(元)
+     * 规格型号
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("定价(元)")
-    @ApiModelProperty("定价(元)")
-    private BigDecimal price;
+    @ExcelProperty("规格型号")
+    @ApiModelProperty("规格型号")
+    private String specificationsModels;
     /**
-     * 折扣
+     * 出版日期
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("折扣(折)")
-    @ApiModelProperty("折扣")
-    private Double discount;
-    /**
-     * 学科组名称
-     */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学科组(必须是系统中已有的学科组名称)")
-    @ApiModelProperty("学科组名称")
-    private String groupName;
+    @ExcelProperty("出版日期")
+    @ApiModelProperty("出版日期")
+    private Date publishingDate;
     /**
-     * 课程
+     * 是否为校企合作教材
      */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("对应课程(必须是系统中已有的课程名称)")
-    @ApiModelProperty("对应课程")
-    private String courseName;
-
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("是否为校企合作教材(是或否)")
     @ApiModelProperty("是否校企合作开发教材")
+    @Required
     private String isSecd;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("教材类型(纸质教材、数字教材、纸质与数字资源结合教材)")
-    @ApiModelProperty("教材类型")
-    private String textbookCategory;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("估价(元)")
-    @ApiModelProperty("估价(元)")
-    private BigDecimal appraisalPrice;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("出版日期")
-    @ApiModelProperty("出版日期")
-    private Date publishingDate;
-
+    /**
+     * 分类号
+     */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("分类号")
     @ApiModelProperty("分类号")
     private String category;
-
+    /**
+     * 规划批次
+     */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("规划批次")
     @ApiModelProperty("规划批次")
     private String planBatch;
-
+    /**
+     * 编著作总数
+     */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("编著作总数")
     @ApiModelProperty("编著作总数")
     private Integer workTotalCount;
+    /**
+     * 教材类型
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材类型(纸质教材、数字教材、纸质与数字资源结合教材)")
+    @ApiModelProperty("教材类型")
+    @Required
+    private String textbookCategory;
+    /**
+     * 定价(元)
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("定价(元)")
+    @ApiModelProperty("定价(元)")
+    @Required
+    private BigDecimal price;
+    /**
+     * 折扣
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("折扣(折)")
+    @ApiModelProperty("折扣")
+    private Double discount;
 }

+ 116 - 0
src/main/java/com/xjrsoft/module/textbook/dto/TextbookListDto.java

@@ -0,0 +1,116 @@
+package com.xjrsoft.module.textbook.dto;
+
+import com.xjrsoft.common.page.ListInput;
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+
+/**
+* @title: 教材管理分页查询入参
+* @Author szs
+* @Date: 2023-12-25
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class TextbookListDto extends ListInput {
+    /**
+     * 学科组名称
+     */
+    @ApiModelProperty("学科组名称")
+    private String groupName;
+    /**
+     * 课程
+     */
+    @ApiModelProperty("课程")
+    private String courseName;
+    /**
+     * 使用类型(单位:学期)
+     */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 国际标准书号
+     */
+    @ApiModelProperty("国际标准书号")
+    private String isbn;
+    /**
+     * 书名
+     */
+    @ApiModelProperty("书名")
+    private String bookName;
+    /**
+     * 出版社
+     */
+    @ApiModelProperty("出版社")
+    private String publishingHouse;
+    /**
+     * 主编
+     */
+    @ApiModelProperty("主编")
+    private String editorInChief;
+    /**
+     * 版本
+     */
+    @ApiModelProperty("版本")
+    private String version;
+    /**
+     * 是否为规划教材
+     */
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookType;
+    /**
+     * 规格型号
+     */
+    @ApiModelProperty("规格型号")
+    private String specificationsModels;
+    /**
+     * 是否校企合作开发教材
+     */
+    @ApiModelProperty("是否校企合作开发教材")
+    private Integer isSecd;
+    /**
+     * 分类号
+     */
+    @ApiModelProperty("分类号")
+    private String category;
+    /**
+     * 规划批次
+     */
+    @ApiModelProperty("规划批次")
+    private String planBatch;
+    /**
+     * 编著作总数
+     */
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
+    /**
+     * 教材类型
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
+    /**
+     * 定价(元)
+     */
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+    /**
+     * 预估折扣
+     */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
+}

+ 98 - 26
src/main/java/com/xjrsoft/module/textbook/dto/TextbookPageDto.java

@@ -1,10 +1,15 @@
 package com.xjrsoft.module.textbook.dto;
 
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
 import com.xjrsoft.common.page.PageInput;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 
 /**
 * @title: 教材管理分页查询入参
@@ -15,32 +20,99 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = false)
 public class TextbookPageDto extends PageInput {
-
-    @ApiModelProperty("教材类型")
-    public String textbookType;
-
-    @ApiModelProperty("学期id")
-    public Long baseSemesterId;
-
-    @ApiModelProperty("学科id")
-    public Long subjectGroupId;
-
-    @ApiModelProperty("课程id")
-    public Long courseSubjectId;
-
+    /**
+     * 学科组名称
+     */
+    @ApiModelProperty("学科组名称")
+    private String groupName;
+    /**
+     * 课程
+     */
+    @ApiModelProperty("课程")
+    private String courseName;
+    /**
+     * 使用类型(单位:学期)
+     */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 国际标准书号
+     */
+    @ApiModelProperty("国际标准书号")
+    private String isbn;
+    /**
+     * 书名
+     */
     @ApiModelProperty("书名")
-    public String bookName;
-
-    @ApiModelProperty("规划教材")
-    public String isTextbookPlan;
-
-    @ApiModelProperty("书号")
-    public String issn;
-
+    private String bookName;
+    /**
+     * 出版社
+     */
+    @ApiModelProperty("出版社")
+    private String publishingHouse;
+    /**
+     * 主编
+     */
     @ApiModelProperty("主编")
-    public String editorInChief;
-
-    @ApiModelProperty("出版色")
-    public String publishingHouse;
-
+    private String editorInChief;
+    /**
+     * 版本
+     */
+    @ApiModelProperty("版本")
+    private String version;
+    /**
+     * 是否为规划教材
+     */
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookType;
+    /**
+     * 规格型号
+     */
+    @ApiModelProperty("规格型号")
+    private String specificationsModels;
+    /**
+     * 是否校企合作开发教材
+     */
+    @ApiModelProperty("是否校企合作开发教材")
+    private Integer isSecd;
+    /**
+     * 分类号
+     */
+    @ApiModelProperty("分类号")
+    private String category;
+    /**
+     * 规划批次
+     */
+    @ApiModelProperty("规划批次")
+    private String planBatch;
+    /**
+     * 编著作总数
+     */
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
+    /**
+     * 教材类型
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
+    /**
+     * 定价(元)
+     */
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+    /**
+     * 预估折扣
+     */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
 }

+ 2 - 1
src/main/java/com/xjrsoft/module/textbook/dto/TextbookSubscriptionListDto.java

@@ -1,5 +1,6 @@
 package com.xjrsoft.module.textbook.dto;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ContentStyle;
 import com.xjrsoft.common.page.PageInput;
@@ -28,6 +29,6 @@ public class TextbookSubscriptionListDto extends PageInput {
     @ApiModelProperty("学期id")
     public Long baseSemesterId;
 
-    @ApiModelProperty("班级ids")
+    @ApiModelProperty(value = "班级ids", hidden = true)
     public List<String> classIdList;
 }

+ 12 - 3
src/main/java/com/xjrsoft/module/textbook/dto/UpdateTextbookDto.java

@@ -2,12 +2,21 @@ package com.xjrsoft.module.textbook.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import java.io.Serializable;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.List;
+import java.util.Date;
+
 
 
 /**
-* @title: 教材管理
-* @Author szs
-* @Date: 2023-12-25
+* @title: 教材基础信息表
+* @Author dzx
+* @Date: 2024-12-13
 * @Version 1.0
 */
 @Data

+ 54 - 85
src/main/java/com/xjrsoft/module/textbook/entity/Textbook.java

@@ -2,29 +2,31 @@ package com.xjrsoft.module.textbook.entity;
 
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.github.yulichang.annotation.EntityMapping;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-
 import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
+import java.util.Date;
 
 
 /**
-* @title: 教材管理
-* @Author szs
-* @Date: 2023-12-25
+* @title: 教材基础信息表
+* @Author dzx
+* @Date: 2024-12-13
 * @Version 1.0
 */
 @Data
 @TableName("textbook")
-@ApiModel(value = "textbook", description = "教材管理")
+@ApiModel(value = "textbook", description = "教材基础信息表")
 public class Textbook implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -78,6 +80,21 @@ public class Textbook implements Serializable {
     @ApiModelProperty("序号")
     private Integer sortCode;
     /**
+    * 学科组管理编号(subject_group)
+    */
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private Long subjectGroupId;
+    /**
+    * 课程编号(base_course_subject)
+    */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private Long courseSubjectId;
+    /**
+    * 使用类型(单位:学期)
+    */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
     * 国际标准刊号
     */
     @ApiModelProperty("国际标准刊号")
@@ -102,45 +119,20 @@ public class Textbook implements Serializable {
     */
     @ApiModelProperty("主编")
     private String editorInChief;
-    /**
-     * 教材核心信息管理id(textbook_core_attribute)
-     */
-    @ApiModelProperty("教材核心信息管理id(textbook_core_attribute)")
-    private Long textbookCoreAttributeId;
-    /**
-    * 学科组管理编号(subject_group)
-    */
-    @ApiModelProperty("学科组管理编号(subject_group)")
-    private Long subjectGroupId;
-    /**
-    * 学期ID(base_semester)
-    */
-    @ApiModelProperty("学期ID(base_semester)")
-    private Long baseSemesterId;
-    /**
-    * 课程编号(base_course_subject)
-    */
-    @ApiModelProperty("课程编号(base_course_subject)")
-    private Long courseSubjectId;
-    /**
-     * 使用年级(base_grade)
-     */
-    @ApiModelProperty("使用年级(base_grade)")
-    private Long gradeId;
     /**
     * 版本
     */
     @ApiModelProperty("版本")
     private String version;
     /**
-    * 是否为规划教材(xjr_dictionary_item[judgment_method_1])
+    * 是否为规划教材
     */
-    @ApiModelProperty("是否为规划教材(xjr_dictionary_item[judgment_method_1])")
-    private String isTextbookPlan;
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
     /**
-    * 教材类(xjr_dictionary_item[textbook_type])
+    * 教材分类(xjr_dictionary_item[textbook_type])
     */
-    @ApiModelProperty("教材类(xjr_dictionary_item[textbook_type])")
+    @ApiModelProperty("教材分类(xjr_dictionary_item[textbook_type])")
     private String textbookType;
     /**
     * 规格型号
@@ -148,68 +140,45 @@ public class Textbook implements Serializable {
     @ApiModelProperty("规格型号")
     private String specificationsModels;
     /**
-    * 估价(元)
+    * 出版日期
     */
-    @ApiModelProperty("估价(元)")
-    private BigDecimal appraisalPrice;
+    @ApiModelProperty("出版日期")
+    private LocalDate publishingDate;
     /**
-    * 定价(元)
+    * 是否校企合作开发教材
     */
-    @ApiModelProperty("定价(元)")
-    private BigDecimal price;
+    @ApiModelProperty("是否校企合作开发教材")
+    private Integer isSecd;
     /**
-    * 折扣
+    * 分类号
     */
-    @ApiModelProperty("折扣")
-    private Double discount;
+    @ApiModelProperty("分类号")
+    private String category;
     /**
-    * 小计(元)
+    * 规划批次
     */
-    @ApiModelProperty("小计(元)")
-    private BigDecimal subtotal;
+    @ApiModelProperty("规划批次")
+    private String planBatch;
     /**
-    * 库存
+    * 编著作总数
     */
-    @ApiModelProperty("库存")
-    private Integer stock;
-
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
     /**
-    * textbookClassRelation
+    * 教材类型
     */
-    @ApiModelProperty("textbookClassRelation子表")
-    @TableField(exist = false)
-    @EntityMapping(thisField = "id", joinField = "textbookId")
-    private List<TextbookClassRelation> textbookClassRelationList;
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
     /**
-    * textbookSubscriptionRecord
+    * 定价(元)
     */
-    @ApiModelProperty("textbookSubscriptionRecord子表")
-    @TableField(exist = false)
-    @EntityMapping(thisField = "id", joinField = "wfTextbookSubscriptionId")
-    private List<TextbookSubscriptionRecord> textbookSubscriptionRecordList;
-
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
     /**
-     * 使用类型(单位:学期)
-     */
-    @ApiModelProperty("使用类型(单位:学期)")
-    private Integer useType;
-
-
-    @ApiModelProperty("是否校企合作开发教材")
-    private Integer isSecd;
-
-    @ApiModelProperty("出版日期")
-    private Date publishingDate;
-
-    @ApiModelProperty("分类号")
-    private String category;
+    * 预估折扣
+    */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
 
-    @ApiModelProperty("规划批次")
-    private String planBatch;
 
-    @ApiModelProperty("编著作总数")
-    private Integer workTotalCount;
-
-    @ApiModelProperty("教材类型")
-    private String textbookCategory;
 }

+ 115 - 0
src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscription.java

@@ -0,0 +1,115 @@
+package com.xjrsoft.module.textbook.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 教材教辅征订记录表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+@TableName("textbook_subscription")
+@ApiModel(value = "textbook_subscription", description = "教材教辅征订记录表")
+public class TextbookSubscription implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+    /**
+    * 学期id(base_semester)
+    */
+    @ApiModelProperty("学期id(base_semester)")
+    private Long baseSemesterId;
+    /**
+    * 征订方式(1:按班级征订 2:按教材征订)
+    */
+    @ApiModelProperty("征订方式(1:按班级征订 2:按教材征订)")
+    private Integer subscriptionMethod;
+    /**
+    * 征订教材总数
+    */
+    @ApiModelProperty("征订教材总数")
+    private Integer sum;
+    /**
+    * 征订状态(0:待发起,1:证订中,2:完成)
+    */
+    @ApiModelProperty("征订状态(0:待发起,1:证订中,2:完成)")
+    private Integer status;
+
+    /**
+    * textbookSubscriptionItem
+    */
+    @ApiModelProperty("textbookSubscriptionItem子表")
+    @TableField(exist = false)
+    @EntityMapping(thisField = "id", joinField = "textbookSubscriptionId")
+    private List<TextbookSubscriptionItem> textbookSubscriptionItemList;
+
+}

+ 98 - 0
src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscriptionClass.java

@@ -0,0 +1,98 @@
+package com.xjrsoft.module.textbook.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 教材征订记录与班级关联表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+@TableName("textbook_subscription_class")
+@ApiModel(value = "textbook_subscription_class", description = "教材征订记录与班级关联表")
+public class TextbookSubscriptionClass implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 备注
+    */
+    @ApiModelProperty("备注")
+    private String remark;
+    /**
+    * 教材征订记录表id(textbook_subscription)
+    */
+    @ApiModelProperty("教材征订记录表id(textbook_subscription)")
+    private Long textbookSubscriptionId;
+    /**
+    * 按班级征订中征订的班级主键(base_class)
+    */
+    @ApiModelProperty("按班级征订中征订的班级主键(base_class)")
+    private Long baseClassId;
+
+
+}

+ 128 - 0
src/main/java/com/xjrsoft/module/textbook/entity/TextbookSubscriptionItem.java

@@ -0,0 +1,128 @@
+package com.xjrsoft.module.textbook.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 教材征订记录详情表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Data
+@TableName("textbook_subscription_item")
+@ApiModel(value = "textbook_subscription_item", description = "教材征订记录详情表")
+public class TextbookSubscriptionItem implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer sortCode;
+    /**
+    * 教材教辅增订记录表主键(textbook_subscription)
+    */
+    @ApiModelProperty("教材教辅增订记录表主键(textbook_subscription)")
+    private Long textbookSubscriptionId;
+    /**
+    * 教材表主键(textbook)
+    */
+    @ApiModelProperty("教材表主键(textbook)")
+    private Long textbookId;
+    /**
+    * 学生用书征订数量
+    */
+    @ApiModelProperty("学生用书征订数量")
+    private Integer studentNum;
+    /**
+    * 教师用书征订数量
+    */
+    @ApiModelProperty("教师用书征订数量")
+    private Integer teacherNum;
+    /**
+    * 实际折扣
+    */
+    @ApiModelProperty("实际折扣")
+    private Double discount;
+    /**
+    * 实际价格(元)
+    */
+    @ApiModelProperty("实际价格(元)")
+    private BigDecimal price;
+    /**
+    * 当前征订任务征订项入库数量
+    */
+    @ApiModelProperty("当前征订任务征订项入库数量")
+    private Integer inStockNum;
+    /**
+    * 当前征订任务征订项出库数量
+    */
+    @ApiModelProperty("当前征订任务征订项出库数量")
+    private Integer outStockNum;
+    /**
+    * 变更类型(0:未变更,1:变更征订数量,2:变更课程)
+    */
+    @ApiModelProperty("变更类型(0:未变更,1:变更征订数量,2:变更课程)")
+    private Integer alterationType;
+
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionClassMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.textbook.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.textbook.entity.TextbookSubscriptionClass;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 教材征订记录与班级关联表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Mapper
+public interface TextbookSubscriptionClassMapper extends MPJBaseMapper<TextbookSubscriptionClass> {
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionItemMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.textbook.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.textbook.entity.TextbookSubscriptionItem;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 教材征订记录详情表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Mapper
+public interface TextbookSubscriptionItemMapper extends MPJBaseMapper<TextbookSubscriptionItem> {
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/textbook/mapper/TextbookSubscriptionMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.textbook.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.textbook.entity.TextbookSubscription;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 教材教辅征订记录表
+* @Author dzx
+* @Date: 2024-12-16
+* @Version 1.0
+*/
+@Mapper
+public interface TextbookSubscriptionMapper extends MPJBaseMapper<TextbookSubscription> {
+
+}

+ 16 - 12
src/main/java/com/xjrsoft/module/textbook/service/ITextbookService.java

@@ -23,18 +23,18 @@ public interface ITextbookService extends MPJBaseService<Textbook> {
     /**
     * 新增
     *
-    * @param textbook
-    * @return
+    * @param textbook 入参
+    * @return 结果
     */
-    Boolean add(Textbook textbook);
+    Boolean addRubAndHand(Textbook textbook);
 
     /**
     * 更新
     *
-    * @param textbook
-    * @return
+     * @param textbook 入参
+     * @return 结果
     */
-    Boolean update(Textbook textbook);
+    Boolean updateRubAndHand(Textbook textbook);
 
     /**
     * 删除
@@ -45,12 +45,16 @@ public interface ITextbookService extends MPJBaseService<Textbook> {
     Boolean delete(List<Long> ids);
 
     /**
-     * 分页查询
-     * @param page
-     * @param dto
-     * @return
+     * 教材基本信息分页查询
+     * @param dto 入参
+     */
+    IPage<TextbookPageVo> pageRubAndHand(TextbookPageDto dto);
+
+    /**
+     * 教材基本信息不分页查询
+     * @param dto 入参
      */
-    Page<TextbookPageVo> getPage(Page<TextbookPageDto> page, TextbookPageDto dto);
+    List<TextbookListVo> listRubAndHand(TextbookListDto dto);
 
     /**
      * 添加教材教辅规则
@@ -127,7 +131,7 @@ public interface ITextbookService extends MPJBaseService<Textbook> {
 
     ByteArrayOutputStream listTextbookClaimExportQuery(TextbookClaimExportQueryDto dto);
 
-    Boolean excelImport(InputStream inputStream);
+//    Boolean excelImport(InputStream inputStream);
 
     IPage<TextbookSubscriptionListVo> getSubscriptionPageByClass(TextbookSubscriptionListDto dto);
 }

+ 7 - 6
src/main/java/com/xjrsoft/module/textbook/service/IWfTextbookSubscriptionService.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.textbook.service;
 
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.textbook.dto.*;
+import com.xjrsoft.module.textbook.entity.TextbookSubscription;
 import com.xjrsoft.module.textbook.entity.WfTextbookSubscription;
 import com.xjrsoft.module.textbook.vo.TextbookInstockroomListVo;
 import com.xjrsoft.module.textbook.vo.TextbookSubscriptionExportQueryListVo;
@@ -19,12 +20,12 @@ import java.util.List;
 
 public interface IWfTextbookSubscriptionService extends MPJBaseService<WfTextbookSubscription> {
     /**
-    * 新增
-    *
-    * @param wfTextbookSubscription
-    * @return
-    */
-    Boolean add(WfTextbookSubscription wfTextbookSubscription);
+     * 新增
+     *
+     * @param textbookSubscription
+     * @return
+     */
+    Boolean add(TextbookSubscription textbookSubscription);
 
     /**
     * 更新

+ 319 - 264
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java

@@ -1,12 +1,9 @@
 package com.xjrsoft.module.textbook.service.impl;
 
-import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
-import com.alibaba.excel.read.listener.PageReadListener;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.metadata.WriteTable;
@@ -16,13 +13,14 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.*;
 import com.xjrsoft.common.exception.MyException;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.common.utils.excel.ExcelFillCellMergePrevColUtil;
 import com.xjrsoft.common.utils.excel.ExcelMergeUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
@@ -30,29 +28,28 @@ import com.xjrsoft.module.base.entity.BaseClassCourse;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.base.mapper.BaseClassCourseMapper;
-import com.xjrsoft.module.base.mapper.BaseCourseSubjectMapper;
 import com.xjrsoft.module.base.mapper.BaseSemesterMapper;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.*;
 import com.xjrsoft.module.textbook.entity.*;
 import com.xjrsoft.module.textbook.mapper.*;
-import com.xjrsoft.module.textbook.service.ITextbookCoreAttributeService;
 import com.xjrsoft.module.textbook.service.ITextbookService;
 import com.xjrsoft.module.textbook.service.ITextbookWarehouseRecordService;
 import com.xjrsoft.module.textbook.service.IWfExerciseBookService;
 import com.xjrsoft.module.textbook.vo.*;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.BorderStyle;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
 import org.apache.poi.ss.usermodel.VerticalAlignment;
-import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -82,143 +79,170 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
     private final TextbookStudentClaimMapper textbookStudentClaimMapper;
 
-    private final SubjectGroupMapper subjectGroupMapper;
-
     private final BaseSemesterMapper baseSemesterMapper;
 
-    private final BaseCourseSubjectMapper baseCourseSubjectMapper;
-
-    private final ITextbookCoreAttributeService textbookCoreAttributeService;
-
-    private final TextbookCoreAttributeMapper textbookCoreAttributeMapper;
-
     private final BaseClassCourseMapper baseClassCourseMapper;
 
+    private final TextbookSubscriptionItemMapper textbookSubscriptionItemMapper;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean add(Textbook textbook) {
-        textbook.setCreateDate(new Date());
-        TextbookCoreAttribute textbookCoreAttribute = new TextbookCoreAttribute();
-        BeanUtils.copyProperties(textbook, textbookCoreAttribute);
-        textbookCoreAttributeMapper.insert(textbookCoreAttribute);
-        textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
-        textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(textbook.getDiscount()/10)));
-        textbookTextbookMapper.insert(textbook);
-        for (TextbookClassRelation textbookClassRelation : textbook.getTextbookClassRelationList()) {
-            textbookClassRelation.setTextbookId(textbook.getId());
-            textbookClassRelation.setCreateDate(new Date());
-            textbookTextbookClassRelationMapper.insert(textbookClassRelation);
+    public Boolean addRubAndHand(Textbook textbook) {
+        // 判断isbn的唯一性
+        if(StringUtils.isBlank(textbook.getIssn())
+                || ObjectUtils.isEmpty(textbook.getSubjectGroupId())
+                || ObjectUtils.isEmpty(textbook.getCourseSubjectId()) ){
+            throw new MyException("issn,学科组,课程为必填字段");
         }
-        if (textbook.getTextbookSubscriptionRecordList() != null) {
-            for (TextbookSubscriptionRecord textbookSubscriptionRecord : textbook.getTextbookSubscriptionRecordList()) {
-                textbookSubscriptionRecord.setTextbookId(textbook.getId());
-                textbookSubscriptionRecord.setCreateDate(new Date());
-                textbookTextbookSubscriptionRecordMapper.insert(textbookSubscriptionRecord);
-            }
+
+        // 判断导入的教材是否已经存在,根据教材的 ISSN 码和使用的学科组和课程判断
+        LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        textbookLambdaQueryWrapper
+                .eq(Textbook::getIssn, textbook.getIssn())
+                .eq(Textbook::getSubjectGroupId, textbook.getSubjectGroupId())
+                .eq(Textbook::getCourseSubjectId, textbook.getCourseSubjectId())
+                .eq(Textbook::getDeleteMark, DeleteMark.NODELETE.getCode())
+        ;
+
+        Textbook verifyTextbook = textbookTextbookMapper.selectOne(textbookLambdaQueryWrapper);
+        int num;
+        if(ObjectUtils.isNotEmpty(verifyTextbook)){
+            textbook.setId(verifyTextbook.getId());
+            num = textbookTextbookMapper.updateById(textbook);
+        }else {
+             num = textbookTextbookMapper.insert(textbook);
         }
-        return true;
+        return num > 0;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean update(Textbook textbook) {
-        textbookTextbookMapper.updateById(textbook);
-        //********************************* TextbookClassRelation  增删改  开始 *******************************************/
-        {
-            // 查出所有子级的id
-            List<TextbookClassRelation> textbookClassRelationList = textbookTextbookClassRelationMapper.selectList(Wrappers.lambdaQuery(TextbookClassRelation.class).eq(TextbookClassRelation::getTextbookId, textbook.getId()).select(TextbookClassRelation::getId));
-            List<Long> textbookClassRelationIds = textbookClassRelationList.stream().map(TextbookClassRelation::getId).collect(Collectors.toList());
-            //原有子表单 没有被删除的主键
-            List<Long> textbookClassRelationOldIds = textbook.getTextbookClassRelationList().stream().map(TextbookClassRelation::getId).filter(Objects::nonNull).collect(Collectors.toList());
-            //找到需要删除的id
-            List<Long> textbookClassRelationRemoveIds = textbookClassRelationIds.stream().filter(item -> !textbookClassRelationOldIds.contains(item)).collect(Collectors.toList());
-
-            for (TextbookClassRelation textbookClassRelation : textbook.getTextbookClassRelationList()) {
-                //如果不等于空则修改
-                if (textbookClassRelation.getId() != null) {
-                    textbookTextbookClassRelationMapper.updateById(textbookClassRelation);
-                }
-                //如果等于空 则新增
-                else {
-                    //已经不存在的id 删除
-                    textbookClassRelation.setTextbookId(textbook.getId());
-                    textbookTextbookClassRelationMapper.insert(textbookClassRelation);
-                }
-            }
-            //已经不存在的id 删除
-            if (textbookClassRelationRemoveIds.size() > 0) {
-                textbookTextbookClassRelationMapper.deleteBatchIds(textbookClassRelationRemoveIds);
-            }
-        }
-        //********************************* TextbookClassRelation  增删改  结束 *******************************************/
-
-        //********************************* TextbookSubscriptionRecord  增删改  开始 *******************************************/
-        {
-            // 查出所有子级的id
-            List<TextbookSubscriptionRecord> textbookSubscriptionRecordList = textbookTextbookSubscriptionRecordMapper.selectList(Wrappers.lambdaQuery(TextbookSubscriptionRecord.class).eq(TextbookSubscriptionRecord::getWfTextbookSubscriptionId, textbook.getId()).select(TextbookSubscriptionRecord::getId));
-            List<Long> textbookSubscriptionRecordIds = textbookSubscriptionRecordList.stream().map(TextbookSubscriptionRecord::getId).collect(Collectors.toList());
-            //原有子表单 没有被删除的主键
-            if (!textbookSubscriptionRecordIds.isEmpty()) {
-                List<Long> textbookSubscriptionRecordOldIds = textbook.getTextbookSubscriptionRecordList().stream().map(TextbookSubscriptionRecord::getId).filter(Objects::nonNull).collect(Collectors.toList());
-                //找到需要删除的id
-                List<Long> textbookSubscriptionRecordRemoveIds = textbookSubscriptionRecordIds.stream().filter(item -> !textbookSubscriptionRecordOldIds.contains(item)).collect(Collectors.toList());
-
-                for (TextbookSubscriptionRecord textbookSubscriptionRecord : textbook.getTextbookSubscriptionRecordList()) {
-                    //如果不等于空则修改
-                    if (textbookSubscriptionRecord.getId() != null) {
-                        textbookTextbookSubscriptionRecordMapper.updateById(textbookSubscriptionRecord);
-                    }
-                    //如果等于空 则新增
-                    else {
-                        //已经不存在的id 删除
-                        textbookSubscriptionRecord.setWfTextbookSubscriptionId(textbook.getId());
-                        textbookTextbookSubscriptionRecordMapper.insert(textbookSubscriptionRecord);
-                    }
-                }
-                //已经不存在的id 删除
-                if (textbookSubscriptionRecordRemoveIds.size() > 0) {
-                    textbookTextbookSubscriptionRecordMapper.deleteBatchIds(textbookSubscriptionRecordRemoveIds);
-                }
-                for (TextbookSubscriptionRecord textbookSubscriptionRecord : textbook.getTextbookSubscriptionRecordList()) {
-                    //如果不等于空则修改
-                    if (textbookSubscriptionRecord.getId() != null) {
-                        textbookTextbookSubscriptionRecordMapper.updateById(textbookSubscriptionRecord);
-                    }
-                    //如果等于空 则新增
-                    else {
-                        //已经不存在的id 删除
-                        textbookSubscriptionRecord.setWfTextbookSubscriptionId(textbook.getId());
-                        textbookTextbookSubscriptionRecordMapper.insert(textbookSubscriptionRecord);
-                    }
-                }
-                //已经不存在的id 删除
-                if (textbookSubscriptionRecordRemoveIds.size() > 0) {
-                    textbookTextbookSubscriptionRecordMapper.deleteBatchIds(textbookSubscriptionRecordRemoveIds);
-                }
+    public Boolean updateRubAndHand(Textbook textbook) {
+        int num = textbookTextbookMapper.updateById(textbook);
+        return num > 0;
+    }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean delete(List<Long> ids) {
+        // 删除教材前应判断教材是否被班级课程使用,一旦被使用不能删除
+        MPJLambdaWrapper<Textbook> baseClassCourse = new MPJLambdaWrapper<>();
+        baseClassCourse
+                .select(Textbook::getId)
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(Textbook.class).contains(x.getProperty()))
+                .innerJoin(BaseClassCourse.class, BaseClassCourse::getTextbookId, Textbook::getId)
+                .in(Textbook::getId, ids)
+                ;
+        List<Textbook> baseClassCourseTextbooks = this.selectJoinList(Textbook.class, baseClassCourse);
 
-            }
-            //********************************* TextbookSubscriptionRecord  增删改  结束 *******************************************/
+        if(!baseClassCourseTextbooks.isEmpty()){
+            throw new MyException(baseClassCourseTextbooks.get(0).getBookName() + "教材在课程中被使用,请先从课程中移除!");
+        }
 
-            return true;
+        // 删除教材前应判断教材是否存在教材征订记录,如果存在征订记录,不应该删除
+        MPJLambdaWrapper<Textbook> textbookSubscriptionItem = new MPJLambdaWrapper<>();
+        textbookSubscriptionItem
+                .select(Textbook::getId)
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(Textbook.class).contains(x.getProperty()))
+                .innerJoin(TextbookSubscriptionItem.class, TextbookSubscriptionItem::getTextbookId, Textbook::getId)
+                .in(Textbook::getId, ids)
+        ;
+        List<Textbook> textbookSubscriptionItemTextbooks = this.selectJoinList(Textbook.class, textbookSubscriptionItem);
+
+        if(!textbookSubscriptionItemTextbooks.isEmpty()){
+            throw new MyException(textbookSubscriptionItemTextbooks.get(0).getBookName() + "教材在证订中被使用,请先从证订中移除!");
         }
+
+        textbookTextbookMapper.deleteBatchIds(ids);
+        return true;
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Boolean delete(List<Long> ids) {
-        textbookTextbookMapper.deleteBatchIds(ids);
-        textbookTextbookClassRelationMapper.delete(Wrappers.lambdaQuery(TextbookClassRelation.class).in(TextbookClassRelation::getTextbookId, ids));
-        textbookTextbookSubscriptionRecordMapper.delete(Wrappers.lambdaQuery(TextbookSubscriptionRecord.class).in(TextbookSubscriptionRecord::getWfTextbookSubscriptionId, ids));
+    public IPage<TextbookPageVo> pageRubAndHand(TextbookPageDto dto) {
+        MPJLambdaWrapper<Textbook> textbookMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        textbookMPJLambdaWrapper
+                .select(Textbook::getId)
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookPageVo.class).contains(x.getProperty()))
+                .leftJoin(SubjectGroup.class, SubjectGroup::getId, Textbook::getSubjectGroupId,
+                        wrapper -> wrapper
+                                .selectAs(SubjectGroup::getGroupName, TextbookPageVo::getGroupName)
+                                .like(StringUtils.isNotBlank(dto.getGroupName()), SubjectGroup::getGroupName, dto.getGroupName())
+                )
+                .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId,
+                        wrapper -> wrapper
+                                .selectAs(BaseCourseSubject::getName, TextbookPageVo::getCourseName)
+                                .like(StringUtils.isNotBlank(dto.getCourseName()), BaseCourseSubject::getName, dto.getCourseName())
+                )
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                        wrapper -> wrapper
+                                .selectAs(DictionaryDetail::getName, TextbookPageVo::getTextbookTypeCn)
+                )
+                .eq(ObjectUtils.isNotEmpty(dto.getUseType()), Textbook::getUseType, dto.getUseType())
+                .like(StringUtils.isNotBlank(dto.getIssn()), Textbook::getIssn, dto.getIssn())
+                .like(StringUtils.isNotBlank(dto.getIsbn()), Textbook::getIsbn, dto.getIsbn())
+                .like(StringUtils.isNotBlank(dto.getBookName()), Textbook::getBookName, dto.getBookName())
+                .like(StringUtils.isNotBlank(dto.getPublishingHouse()), Textbook::getPublishingHouse, dto.getPublishingHouse())
+                .like(StringUtils.isNotBlank(dto.getEditorInChief()), Textbook::getEditorInChief, dto.getEditorInChief())
+                .eq(StringUtils.isNotBlank(dto.getVersion()), Textbook::getVersion, dto.getVersion())
+                .eq(ObjectUtils.isNotEmpty(dto.getIsTextbookPlan()), Textbook::getIsTextbookPlan, dto.getIsTextbookPlan())
+                .eq(StringUtils.isNotBlank(dto.getTextbookType()), Textbook::getTextbookType, dto.getTextbookType())
+                .eq(StringUtils.isNotBlank(dto.getSpecificationsModels()), Textbook::getSpecificationsModels, dto.getSpecificationsModels())
+                .eq(ObjectUtils.isNotEmpty(dto.getIsSecd()), Textbook::getIsSecd, dto.getIsSecd())
+                .eq(StringUtils.isNotBlank(dto.getCategory()), Textbook::getCategory, dto.getCategory())
+                .eq(StringUtils.isNotBlank(dto.getPlanBatch()), Textbook::getPlanBatch, dto.getPlanBatch())
+                .eq(ObjectUtils.isNotEmpty(dto.getWorkTotalCount()), Textbook::getWorkTotalCount, dto.getWorkTotalCount())
+                .eq(StringUtils.isNotBlank(dto.getTextbookCategory()), Textbook::getTextbookCategory, dto.getTextbookCategory())
+                .eq(ObjectUtils.isNotEmpty(dto.getPrice()), Textbook::getPrice, dto.getPrice())
+                .eq(ObjectUtils.isNotEmpty(dto.getDiscount()), Textbook::getDiscount, dto.getDiscount())
+                .orderByDesc(Textbook::getId)
+                ;
 
-        return true;
+        return textbookTextbookMapper.selectJoinPage(ConventPage.getPage(dto), TextbookPageVo.class, textbookMPJLambdaWrapper);
     }
 
     @Override
-    public Page<TextbookPageVo> getPage(Page<TextbookPageDto> page, TextbookPageDto dto) {
-        return textbookTextbookMapper.getPage(page, dto);
+    public List<TextbookListVo> listRubAndHand(TextbookListDto dto) {
+        MPJLambdaWrapper<Textbook> textbookMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        textbookMPJLambdaWrapper
+                .select(Textbook::getId)
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookListVo.class).contains(x.getProperty()))
+                .leftJoin(SubjectGroup.class, SubjectGroup::getId, Textbook::getSubjectGroupId,
+                        wrapper -> wrapper
+                                .selectAs(SubjectGroup::getGroupName, TextbookListVo::getGroupName)
+                                .like(StringUtils.isNotBlank(dto.getGroupName()), SubjectGroup::getGroupName, dto.getGroupName())
+                )
+                .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId,
+                        wrapper -> wrapper
+                                .selectAs(BaseCourseSubject::getName, TextbookListVo::getCourseName)
+                                .like(StringUtils.isNotBlank(dto.getCourseName()), BaseCourseSubject::getName, dto.getCourseName())
+                )
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                        wrapper -> wrapper
+                                .selectAs(DictionaryDetail::getName, TextbookListVo::getTextbookTypeCn)
+                )
+                .eq(ObjectUtils.isNotEmpty(dto.getUseType()), Textbook::getUseType, dto.getUseType())
+                .like(StringUtils.isNotBlank(dto.getIssn()), Textbook::getIssn, dto.getIssn())
+                .like(StringUtils.isNotBlank(dto.getIsbn()), Textbook::getIsbn, dto.getIsbn())
+                .like(StringUtils.isNotBlank(dto.getBookName()), Textbook::getBookName, dto.getBookName())
+                .like(StringUtils.isNotBlank(dto.getPublishingHouse()), Textbook::getPublishingHouse, dto.getPublishingHouse())
+                .like(StringUtils.isNotBlank(dto.getEditorInChief()), Textbook::getEditorInChief, dto.getEditorInChief())
+                .eq(StringUtils.isNotBlank(dto.getVersion()), Textbook::getVersion, dto.getVersion())
+                .eq(ObjectUtils.isNotEmpty(dto.getIsTextbookPlan()), Textbook::getIsTextbookPlan, dto.getIsTextbookPlan())
+                .eq(StringUtils.isNotBlank(dto.getTextbookType()), Textbook::getTextbookType, dto.getTextbookType())
+                .eq(StringUtils.isNotBlank(dto.getSpecificationsModels()), Textbook::getSpecificationsModels, dto.getSpecificationsModels())
+                .eq(ObjectUtils.isNotEmpty(dto.getIsSecd()), Textbook::getIsSecd, dto.getIsSecd())
+                .eq(StringUtils.isNotBlank(dto.getCategory()), Textbook::getCategory, dto.getCategory())
+                .eq(StringUtils.isNotBlank(dto.getPlanBatch()), Textbook::getPlanBatch, dto.getPlanBatch())
+                .eq(ObjectUtils.isNotEmpty(dto.getWorkTotalCount()), Textbook::getWorkTotalCount, dto.getWorkTotalCount())
+                .eq(StringUtils.isNotBlank(dto.getTextbookCategory()), Textbook::getTextbookCategory, dto.getTextbookCategory())
+                .eq(ObjectUtils.isNotEmpty(dto.getPrice()), Textbook::getPrice, dto.getPrice())
+                .eq(ObjectUtils.isNotEmpty(dto.getDiscount()), Textbook::getDiscount, dto.getDiscount())
+        ;
+
+        return textbookTextbookMapper.selectJoinList(TextbookListVo.class, textbookMPJLambdaWrapper);
     }
 
+
    /* @Override
     @Transactional
     public Boolean dataHandleAddTextbookNode(Long dataId) {
@@ -342,48 +366,40 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
     @Transactional
     public Boolean dataHandleAddExerciseBookNode(Long dataId) {
         WfExerciseBook wfExerciseBook = wfExerciseBookService.selectById(dataId);
-        if (ObjectUtil.isNotNull(wfExerciseBook) && ObjectUtil.isNotNull(wfExerciseBook.getWfExerciseBookItemList()) && wfExerciseBook.getWfExerciseBookItemList().size() > 0) {
+        if (ObjectUtils.isNotEmpty(wfExerciseBook) && ObjectUtils.isNotEmpty(wfExerciseBook.getWfExerciseBookItemList()) && wfExerciseBook.getWfExerciseBookItemList().size() > 0) {
             for (WfExerciseBookItem wfExerciseBookItem : wfExerciseBook.getWfExerciseBookItemList()) {
                 Long semesterId = wfExerciseBook.getBaseSemesterId();
                 String bookName = wfExerciseBookItem.getSubscriptionType();//作业本的选择类型对应教材管理的书名
                 LambdaQueryWrapper<Textbook> queryWrapper = new LambdaQueryWrapper<>();
                 queryWrapper
                         .eq(Textbook::getBookName, bookName)
-                        .eq(Textbook::getBaseSemesterId, semesterId);
+                        ;
                 List<Textbook> textbookList = this.list(queryWrapper);
                 //征订的作业本没有在教材管理
-                if (ObjectUtil.isNull(textbookList) || textbookList.size() == 0) {
+                if (ObjectUtils.isEmpty(textbookList) || textbookList.size() == 0) {
                     Textbook textbook = new Textbook() {{
                         setIssn("/");
                         setIsbn("/");
-                        if (ObjectUtil.isNotNull(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook1.getCode())) {
+                        if (ObjectUtils.isNotEmpty(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook1.getCode())) {
                             setBookName(ExerciseBookeTypeEnum.ExerciseBook1.getValue());
                         }
-                        if (ObjectUtil.isNotNull(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook2.getCode())) {
+                        if (ObjectUtils.isNotEmpty(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook2.getCode())) {
                             setBookName(ExerciseBookeTypeEnum.ExerciseBook2.getValue());
                         }
                         setPublishingHouse("/");
                         setEditorInChief("/");
-                        setBaseSemesterId(wfExerciseBook.getBaseSemesterId());
                         setVersion("/");
-                        setIsTextbookPlan("/");
                         setTextbookType(TextbookTypeEnum.TExerciseBook.getCode());
-                        setSpecificationsModels((ObjectUtil.isNull(wfExerciseBookItem.getSpecificationsModels()) || StringUtils.isBlank(wfExerciseBookItem.getSpecificationsModels())) ? "/" : wfExerciseBookItem.getSpecificationsModels());
+                        setSpecificationsModels((ObjectUtils.isEmpty(wfExerciseBookItem.getSpecificationsModels()) || StringUtils.isBlank(wfExerciseBookItem.getSpecificationsModels())) ? "/" : wfExerciseBookItem.getSpecificationsModels());
                         //年级id
-                        if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
+                        if (ObjectUtils.isNotEmpty(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
                             LambdaQueryWrapper<BaseClass> queryWrapper1 = new LambdaQueryWrapper<>();
                             queryWrapper1
                                     .eq(BaseClass::getId, wfExerciseBook.getClassId());
                             BaseClass baseClass = baseClassService.getOne(queryWrapper1);
-                            if (ObjectUtil.isNotNull(baseClass)) {
-                                setGradeId(baseClass.getGradeId());
-                            }
                         }
-                        setAppraisalPrice((ObjectUtil.isNull(wfExerciseBookItem.getAppraisalPrice())) ? new BigDecimal(0) : wfExerciseBookItem.getAppraisalPrice());
                         setPrice(new BigDecimal(0));
                         setDiscount(10D);
-                        setSubtotal(new BigDecimal(0));
-                        setStock(0);
                     }};
 
                     //插入教材数据
@@ -391,7 +407,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     textbookTextbookMapper.insert(textbook);
 
                     //插入班级和教材关系
-                    if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
+                    if (ObjectUtils.isNotEmpty(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
                         textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
                             setCreateDate(new Date());
                             setTextbookId(textbook.getId());
@@ -411,7 +427,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     Textbook textbook = textbookList.get(0);
 
                     //班级不为空
-                    if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
+                    if (ObjectUtils.isNotEmpty(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
                         textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
                             setCreateDate(new Date());
                             setTextbookId(textbook.getId());
@@ -453,7 +469,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         if (textbook.getTextbookType().equals(TextbookTypeEnum.TTextbook.getCode()) || textbook.getTextbookType().equals(TextbookTypeEnum.TMaterials.getCode())) {
             recordVos = textbookTextbookMapper.subscriptionList(id);
             for (TextbookSubscriptionRecordVo recordVo : recordVos) {
-                if (ObjectUtil.isNull(recordVo) || StrUtil.isEmpty(recordVo.getClassIds())) {
+                if (ObjectUtils.isEmpty(recordVo) || StrUtil.isEmpty(recordVo.getClassIds())) {
 //                    recordVos.remove(recordVo);
 //                    if (recordVos.isEmpty()) {
 //                        break;
@@ -887,18 +903,18 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         return bot;
     }
 
-    @Override
-    @Transactional
-    public Boolean excelImport(InputStream inputStream) {
-        EasyExcel.read(inputStream, TextbookImportDto.class, new PageReadListener<TextbookImportDto>(dataList -> {
-            if (dataList.isEmpty()) {
-                throw new MyException("导入数据为空");
-            }
-            saveData(dataList);
-        })).sheet().headRowNumber(3).doRead();
-
-        return true;
-    }
+//    @Override
+//    @Transactional
+//    public Boolean excelImport(InputStream inputStream) {
+//        EasyExcel.read(inputStream, TextbookImportDto.class, new PageReadListener<TextbookImportDto>(dataList -> {
+//            if (dataList.isEmpty()) {
+//                throw new MyException("导入数据为空");
+//            }
+//            saveData(dataList);
+//        })).sheet().headRowNumber(3).doRead();
+//
+//        return true;
+//    }
 
     @Override
     public IPage<TextbookSubscriptionListVo> getSubscriptionPageByClass(TextbookSubscriptionListDto dto) {
@@ -909,137 +925,179 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         }
         dto.setClassIdList(classIdList);
 
-        IPage<TextbookSubscriptionListVo> page = this.baseMapper.getSubscriptionPageByClass(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        // 找到可以使用多个学期且已经征订的教材
+        MPJLambdaWrapper<BaseClassCourse> subscribedTextbook = new MPJLambdaWrapper<>();
+        subscribedTextbook
+                .distinct()
+                .select(BaseClassCourse::getId)
+                .innerJoin(TextbookSubscriptionClass.class, TextbookSubscriptionClass::getBaseClassId, BaseClassCourse::getClassId)
+                .innerJoin(TextbookSubscriptionItem.class, wrapper -> wrapper
+                        .eq(TextbookSubscriptionItem::getTextbookSubscriptionId, TextbookSubscriptionClass::getTextbookSubscriptionId)
+                        .eq(TextbookSubscriptionItem::getTextbookId, BaseClassCourse::getTextbookId)
+                        )
+
+                .innerJoin(Textbook.class, Textbook::getId, BaseClassCourse::getTextbookId)
+                .gt(Textbook::getUseType, 1)
+                .eq(BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
+                .in(BaseClassCourse::getClassId, dto.getClassIdList())
+        ;
+        List<BaseClassCourse> baseClassCourses = baseClassCourseMapper.selectJoinList(BaseClassCourse.class, subscribedTextbook);
+
+        List<Long> baseClassCourseIds = baseClassCourses.stream()
+                .map(BaseClassCourse::getId)
+                .collect(Collectors.toList());
+
+        MPJLambdaWrapper<BaseClassCourse> baseClassCourseMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        baseClassCourseMPJLambdaWrapper
+                .disableSubLogicDel()
+                .distinct()
+                .selectAs(BaseClassCourse::getCourseId, TextbookSubscriptionListVo::getCourseSubjectId)
+                .selectAs(BaseClassCourse::getTextbookId, TextbookSubscriptionListVo::getTextbookId)
+                .selectAs(BaseCourseSubject::getName, TextbookSubscriptionListVo::getCourseName)
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookSubscriptionListVo.class).contains(x.getProperty()))
+                .innerJoin(Textbook.class, Textbook::getId, BaseClassCourse::getTextbookId)
+                .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, BaseClassCourse::getCourseId)
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                wrapper -> wrapper
+                        .selectAs(DictionaryDetail::getName, TextbookSubscriptionListVo::getTextbookTypeCn)
+                )
+                .eq(BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
+                .in(BaseClassCourse::getClassId, dto.getClassIdList())
+                .notIn(!baseClassCourseIds.isEmpty(), BaseClassCourse::getId, baseClassCourseIds)
+                .eq(BaseClassCourse::getDeleteMark, DeleteMark.NODELETE.getCode())
+                .eq(Textbook::getDeleteMark, DeleteMark.NODELETE.getCode())
+                ;
+        IPage<TextbookSubscriptionListVo> textbookSubscriptionListVoIPage = baseClassCourseMapper.selectJoinPage(ConventPage.getPage(dto), TextbookSubscriptionListVo.class, baseClassCourseMPJLambdaWrapper);
+//        IPage<TextbookSubscriptionListVo> page = this.baseMapper.getSubscriptionPageByClass(new Page<>(dto.getLimit(), dto.getSize()), dto);
 
         // 处理每本教材使用的人数
         if(!classIdList.isEmpty()) {
-            for(TextbookSubscriptionListVo t : page.getRecords()){
-                MPJLambdaWrapper<BaseClassCourse> baseClassCourseMPJLambdaWrapper = new MPJLambdaWrapper<>();
-                baseClassCourseMPJLambdaWrapper
+            for(TextbookSubscriptionListVo t : textbookSubscriptionListVoIPage.getRecords()){
+                MPJLambdaWrapper<BaseClassCourse> countNum = new MPJLambdaWrapper<>();
+                countNum
                         .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getClassId, BaseClassCourse::getClassId)
-                        .in(BaseClassCourse::getClassId, classIdList)
-                        .eq(BaseClassCourse::getTextbookId, t.getId())
-                        .eq(BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
                         .eq(BaseStudentSchoolRoll::getArchivesStatus, ArchivesStatusEnum.FB2901.getCode())
+                        .eq(BaseClassCourse::getTextbookId, t.getTextbookId())
+                        .eq(BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
+                        .in(BaseClassCourse::getClassId, dto.getClassIdList())
+                        .notIn(!baseClassCourseIds.isEmpty(), BaseClassCourse::getId, baseClassCourseIds)
+                        .eq(BaseClassCourse::getDeleteMark, DeleteMark.NODELETE.getCode())
                 ;
-                Long num = baseClassCourseMapper.selectCount(baseClassCourseMPJLambdaWrapper);
+                Long num = baseClassCourseMapper.selectCount(countNum);
                 t.setStudentSubscriptionNumber(num.intValue());
 
                 t.setClassIds(dto.getClassIds());
-                if(t.getTextbookType() != null && !t.getTextbookType().isEmpty()){
-                    t.setTextbookTypeCn(TextbookTypeEnum.getValue(t.getTextbookType()));
-                }
             }
         }
 
-        return page;
+        return textbookSubscriptionListVoIPage;
     }
 
-    private void saveData(List<TextbookImportDto> dataList) {
-        //查询所有需要的数据
-        //学科组
-        List<SubjectGroup> subjectGroupList = subjectGroupMapper.selectList(new LambdaQueryWrapper<>());
-        Map<String, Long> subjectGroupNameAndIdMap = subjectGroupList.stream().collect(Collectors.toMap(SubjectGroup::getGroupName, SubjectGroup::getId, (k1, k2) -> k1));
-
-        //使用课程
-        List<BaseCourseSubject> baseCourseSubjectList = baseCourseSubjectMapper.selectList(new LambdaQueryWrapper<>());
-        Map<String, Long> baseCourseSubjectNameAndIdMap = baseCourseSubjectList.stream().collect(Collectors.toMap(BaseCourseSubject::getName, BaseCourseSubject::getId, (k1, k2) -> k1));
-
-        //批量插入或更新数据
-        for (TextbookImportDto textbookImportDto : dataList) {
-            TextbookCoreAttribute textbookCoreAttribute = new TextbookCoreAttribute();
-            BeanUtils.copyProperties(textbookImportDto, textbookCoreAttribute);
-
-            Textbook textbook = new Textbook();
-            BeanUtils.copyProperties(textbookImportDto, textbook);
-
-            // 处理学科组映射
-            String groupName = textbookImportDto.getGroupName();
-            Long subjectGroupId = Optional.ofNullable(groupName)
-                    .map(subjectGroupNameAndIdMap::get)
-                    .orElse(null);
-            textbook.setSubjectGroupId(subjectGroupId);
-
-            // 处理课程映射
-            String courseName = textbookImportDto.getCourseName();
-            Long courseSubjectId = Optional.ofNullable(courseName)
-                    .map(baseCourseSubjectNameAndIdMap::get)
-                    .orElse(null);
-            textbook.setCourseSubjectId(courseSubjectId);
-
-            // 处理是否教材计划字段
-            String isTextbookPlanCn = textbookImportDto.getIsTextbookPlanCn();
-            String isTextbookPlan = Optional.ofNullable(isTextbookPlanCn)
-                    .filter("是"::equals)
-                    .map(s -> "yes")
-                    .orElse("no");
-            textbook.setIsTextbookPlan(isTextbookPlan);
-
-            String isSecd = textbookImportDto.getIsSecd();
-            Integer isSecdI = Optional.ofNullable(isSecd)
-                    .filter("是"::equals)
-                    .map(s -> 1)
-                    .orElse(0);
-            textbook.setIsSecd(isSecdI);
-
-            // 处理教材类型映射
-            String textbookTypeCn = textbookImportDto.getTextbookTypeCn();
-            String textbookTypeCode = Optional.ofNullable(textbookTypeCn)
-                    .map(TextbookTypeEnum::getCode)
-                    .orElse(null);
-            textbook.setTextbookType(textbookTypeCode);
-
-            //处理使用类型
-            textbook.setUseType(UseSemesterTypeEnum.getCode(textbookImportDto.getUseTypeCn()));
-            Double discount = 1d;
-            if(textbook.getDiscount() != null){
-                discount = textbook.getDiscount();
-            }
-            //处理小计
-            textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(discount / 10)));
-
-            // 判断导入的教材是否已经存在,根据教材的 ISBN 码和使用的学期判断
-            LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            textbookLambdaQueryWrapper
-                    .eq(Textbook::getIssn, textbook.getIssn())
-            ;
-
-            Textbook oldTextbook = this.getOne(textbookLambdaQueryWrapper);
-
-            Date now = new Date();
-            Long loginId = StpUtil.getLoginIdAsLong();
-            // 已经存在,更新数据
-            if (oldTextbook != null) {
-                // 更新教材数据
-                textbookCoreAttribute.setId(oldTextbook.getTextbookCoreAttributeId());
-                textbookCoreAttribute.setModifyDate(now);
-                textbookCoreAttribute.setModifyUserId(loginId);
-                textbookCoreAttributeService.updateById(textbookCoreAttribute);
-
-                textbook.setId(oldTextbook.getId());
-                textbook.setModifyDate(now);
-                textbook.setModifyUserId(loginId);
-                textbookTextbookMapper.updateById(textbook);
-            } else {
-                textbookCoreAttribute.setCreateDate(now);
-                textbookCoreAttribute.setCreateUserId(loginId);
-                textbookCoreAttributeService.save(textbookCoreAttribute);
-
-                // 插入教材数据
-                textbook.setCreateDate(now);
-                textbook.setCreateUserId(loginId);
-                textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
-                textbookTextbookMapper.insert(textbook);
-            }
-        }
-    }
+//    private void saveData(List<TextbookImportDto> dataList) {
+//        //查询所有需要的数据
+//        //学科组
+//        List<SubjectGroup> subjectGroupList = subjectGroupMapper.selectList(new LambdaQueryWrapper<>());
+//        Map<String, Long> subjectGroupNameAndIdMap = subjectGroupList.stream().collect(Collectors.toMap(SubjectGroup::getGroupName, SubjectGroup::getId, (k1, k2) -> k1));
+//
+//        //使用课程
+//        List<BaseCourseSubject> baseCourseSubjectList = baseCourseSubjectMapper.selectList(new LambdaQueryWrapper<>());
+//        Map<String, Long> baseCourseSubjectNameAndIdMap = baseCourseSubjectList.stream().collect(Collectors.toMap(BaseCourseSubject::getName, BaseCourseSubject::getId, (k1, k2) -> k1));
+//
+//        //批量插入或更新数据
+//        for (TextbookImportDto textbookImportDto : dataList) {
+//            TextbookCoreAttribute textbookCoreAttribute = new TextbookCoreAttribute();
+//            BeanUtils.copyProperties(textbookImportDto, textbookCoreAttribute);
+//
+//            Textbook textbook = new Textbook();
+//            BeanUtils.copyProperties(textbookImportDto, textbook);
+//
+//            // 处理学科组映射
+//            String groupName = textbookImportDto.getGroupName();
+//            Long subjectGroupId = Optional.ofNullable(groupName)
+//                    .map(subjectGroupNameAndIdMap::get)
+//                    .orElse(null);
+//            textbook.setSubjectGroupId(subjectGroupId);
+//
+//            // 处理课程映射
+//            String courseName = textbookImportDto.getCourseName();
+//            Long courseSubjectId = Optional.ofNullable(courseName)
+//                    .map(baseCourseSubjectNameAndIdMap::get)
+//                    .orElse(null);
+//            textbook.setCourseSubjectId(courseSubjectId);
+//
+//            // 处理是否教材计划字段
+//            String isTextbookPlanCn = textbookImportDto.getIsTextbookPlanCn();
+//            String isTextbookPlan = Optional.ofNullable(isTextbookPlanCn)
+//                    .filter("是"::equals)
+//                    .map(s -> "yes")
+//                    .orElse("no");
+//            textbook.setIsTextbookPlan(isTextbookPlan);
+//
+//            String isSecd = textbookImportDto.getIsSecd();
+//            Integer isSecdI = Optional.ofNullable(isSecd)
+//                    .filter("是"::equals)
+//                    .map(s -> 1)
+//                    .orElse(0);
+//            textbook.setIsSecd(isSecdI);
+//
+//            // 处理教材类型映射
+//            String textbookTypeCn = textbookImportDto.getTextbookTypeCn();
+//            String textbookTypeCode = Optional.ofNullable(textbookTypeCn)
+//                    .map(TextbookTypeEnum::getCode)
+//                    .orElse(null);
+//            textbook.setTextbookType(textbookTypeCode);
+//
+//            //处理使用类型
+//            textbook.setUseType(UseSemesterTypeEnum.getCode(textbookImportDto.getUseTypeCn()));
+//            Double discount = 1d;
+//            if(textbook.getDiscount() != null){
+//                discount = textbook.getDiscount();
+//            }
+//            //处理小计
+//            textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(discount / 10)));
+//
+//            // 判断导入的教材是否已经存在,根据教材的 ISBN 码和使用的学期判断
+//            LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
+//            textbookLambdaQueryWrapper
+//                    .eq(Textbook::getIssn, textbook.getIssn())
+//            ;
+//
+//            Textbook oldTextbook = this.getOne(textbookLambdaQueryWrapper);
+//
+//            Date now = new Date();
+//            Long loginId = StpUtil.getLoginIdAsLong();
+//            // 已经存在,更新数据
+//            if (oldTextbook != null) {
+//                // 更新教材数据
+//                textbookCoreAttribute.setId(oldTextbook.getTextbookCoreAttributeId());
+//                textbookCoreAttribute.setModifyDate(now);
+//                textbookCoreAttribute.setModifyUserId(loginId);
+//                textbookCoreAttributeService.updateById(textbookCoreAttribute);
+//
+//                textbook.setId(oldTextbook.getId());
+//                textbook.setModifyDate(now);
+//                textbook.setModifyUserId(loginId);
+//                textbookTextbookMapper.updateById(textbook);
+//            } else {
+//                textbookCoreAttribute.setCreateDate(now);
+//                textbookCoreAttribute.setCreateUserId(loginId);
+//                textbookCoreAttributeService.save(textbookCoreAttribute);
+//
+//                // 插入教材数据
+//                textbook.setCreateDate(now);
+//                textbook.setCreateUserId(loginId);
+//                textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
+//                textbookTextbookMapper.insert(textbook);
+//            }
+//        }
+//    }
 
     @Override
     @Transactional
     public Boolean deliverWarehouse(AddTextbookWarehouseRecordDto dto) {
         //根据id获取教材管理记录
         Textbook textbook = this.getById(dto.getTextbookId());
-        if (ObjectUtil.isNull(textbook)) {
+        if (ObjectUtils.isEmpty(textbook)) {
             throw new MyException("入库失败,该教材不存在");
         }
 
@@ -1050,8 +1108,6 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         this.updateById(new Textbook() {
             {
                 setId(textbook.getId());
-                Integer oldStock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
-                setStock(oldStock + (ObjectUtil.isNull(dto.getWarehouseNumber()) ? 0 : dto.getWarehouseNumber()));
 //                setPrice(price);
 //                setDiscount(discount);
 //                setSubtotal(subtotal);
@@ -1062,7 +1118,6 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         TextbookWarehouseRecord textbookWarehouseRecord = BeanUtil.toBean(dto, TextbookWarehouseRecord.class);
         textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
         textbookWarehouseRecord.setDiscount(textbook.getDiscount());
-        textbookWarehouseRecord.setSubtotal(textbook.getSubtotal());
         textbookWarehouseRecord.setCreateDate(new Date());
         QueryWrapper<TextbookWarehouseRecord> queryWrapperSortcode = new QueryWrapper<>();
         queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");

+ 0 - 5
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookClaimServiceImpl.java

@@ -231,10 +231,6 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
             }
 
             //判断发放量是否多于库存量
-            Integer stock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
-            if (stock < confirmNumber) {
-                throw new MyException(textbook.getBookName() + "库存不足");
-            }
 
             //增加出库记录
             textbookIssueRecordService.save(new TextbookIssueRecord() {{
@@ -265,7 +261,6 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 setModifyUserId(StpUtil.getLoginIdAsLong());
                 setModifyDate(new Date());
                 setId(textbook.getId());
-                setStock(stock - confirmNumber);
             }});
 
             //更新申领项中的已经发放数量

+ 2 - 2
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookRecedeServiceImpl.java

@@ -130,7 +130,7 @@ public class WfTextbookRecedeServiceImpl extends MPJBaseServiceImpl<WfTextbookRe
                             setModifyUserId(StpUtil.getLoginIdAsLong());
                             setModifyDate(new Date());
                             setId(wfTextbookRecedeItem.getTextbookId());
-                            setStock((ObjectUtil.isNull(textbook.getStock())?0:textbook.getStock()) + (ObjectUtil.isNull(wfTextbookRecedeItem.getNumber())?0:wfTextbookRecedeItem.getNumber()));
+//                            setStock((ObjectUtil.isNull(textbook.getStock())?0:textbook.getStock()) + (ObjectUtil.isNull(wfTextbookRecedeItem.getNumber())?0:wfTextbookRecedeItem.getNumber()));
                         }});
                         //增加入库记录
                         textbookWarehouseRecordMapper.insert(new TextbookWarehouseRecord(){{
@@ -159,7 +159,7 @@ public class WfTextbookRecedeServiceImpl extends MPJBaseServiceImpl<WfTextbookRe
                             setModifyUserId(StpUtil.getLoginIdAsLong());
                             setModifyDate(new Date());
                             setId(wfTextbookRecedeItem.getTextbookId());
-                            setStock((ObjectUtil.isNull(textbook.getStock())?0:textbook.getStock()) - (ObjectUtil.isNull(wfTextbookRecedeItem.getNumber())?0:wfTextbookRecedeItem.getNumber()) );
+//                            setStock((ObjectUtil.isNull(textbook.getStock())?0:textbook.getStock()) - (ObjectUtil.isNull(wfTextbookRecedeItem.getNumber())?0:wfTextbookRecedeItem.getNumber()) );
                         }});
                         //增加出库记录
                         textbookIssueRecordMapper.insert(new TextbookIssueRecord(){{

+ 36 - 41
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java

@@ -21,15 +21,8 @@ import com.xjrsoft.module.textbook.dto.TextbookSubscriptionExportQueryListDto;
 import com.xjrsoft.module.textbook.dto.UpdateWfTextbookSubscriptionDto;
 import com.xjrsoft.module.textbook.dto.UpdateWfTextbookSubscriptionItemDto;
 import com.xjrsoft.module.textbook.dto.WfTextbookSubscriptionDto;
-import com.xjrsoft.module.textbook.entity.Textbook;
-import com.xjrsoft.module.textbook.entity.TextbookSubscriptionRecord;
-import com.xjrsoft.module.textbook.entity.WfTextbookSubscription;
-import com.xjrsoft.module.textbook.entity.WfTextbookSubscriptionItem;
-import com.xjrsoft.module.textbook.entity.WfTextbookSubscriptionItemHistory;
-import com.xjrsoft.module.textbook.mapper.TextbookSubscriptionRecordMapper;
-import com.xjrsoft.module.textbook.mapper.WfTextbookSubscriptionItemHistoryMapper;
-import com.xjrsoft.module.textbook.mapper.WfTextbookSubscriptionItemMapper;
-import com.xjrsoft.module.textbook.mapper.WfTextbookSubscriptionMapper;
+import com.xjrsoft.module.textbook.entity.*;
+import com.xjrsoft.module.textbook.mapper.*;
 import com.xjrsoft.module.textbook.service.ITextbookService;
 import com.xjrsoft.module.textbook.service.IWfTextbookSubscriptionService;
 import com.xjrsoft.module.textbook.vo.TextbookInstockroomListVo;
@@ -37,6 +30,7 @@ import com.xjrsoft.module.textbook.vo.TextbookSubscriptionExportQueryListVo;
 import com.xjrsoft.module.textbook.vo.WfTextbookSubscriptionItemVo;
 import com.xjrsoft.module.textbook.vo.WfTextbookSubscriptionVo;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -71,21 +65,39 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
 
     private final WfTextbookSubscriptionItemHistoryMapper wfTextbookSubscriptionItemHistoryMapper;
 
+    private final TextbookSubscriptionMapper textbookSubscriptionMapper;
+
+    private final TextbookSubscriptionItemMapper textbookSubscriptionItemMapper;
+
+    private final TextbookSubscriptionClassMapper textbookSubscriptionClassMapper;
+
     private final ITextbookService textbookService;
 
     private final BaseClassMapper baseClassMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean add(WfTextbookSubscription wfTextbookSubscription) {
-        wfTextbookSubscription.setApplicantUserId(StpUtil.getLoginIdAsLong());
-        wfTextbookSubscription.setStatus(1);
-        wfTextbookSubscription.setCreateDate(new Date());
-        wfTextbookSubscriptionWfTextbookSubscriptionMapper.insert(wfTextbookSubscription);
-        for (WfTextbookSubscriptionItem wfTextbookSubscriptionItem : wfTextbookSubscription.getWfTextbookSubscriptionItemList()) {
-            wfTextbookSubscriptionItem.setWfTextbookSubscriptionId(wfTextbookSubscription.getId());
-            wfTextbookSubscriptionItem.setCreateDate(new Date());
-            wfTextbookSubscriptionWfTextbookSubscriptionItemMapper.insert(wfTextbookSubscriptionItem);
+    public Boolean add(TextbookSubscription textbookSubscription) {
+        // 处理征订表
+        int sum = 0;
+        for (TextbookSubscriptionItem textbookSubscriptionItem : textbookSubscription.getTextbookSubscriptionItemList()) {
+            sum += textbookSubscriptionItem.getStudentNum() + textbookSubscriptionItem.getTeacherNum();
+        }
+        textbookSubscriptionMapper.insert(textbookSubscription);
+
+        // 处理征订和班级关联表
+        if(ObjectUtils.isNotEmpty(textbookSubscription.getSubscriptionMethod())
+            && textbookSubscription.getSubscriptionMethod() == 1
+        ){
+            TextbookSubscriptionClass textbookSubscriptionClass = new TextbookSubscriptionClass();
+            textbookSubscriptionClass.setTextbookSubscriptionId(textbookSubscription.getId());
+            textbookSubscriptionClassMapper.insert(textbookSubscriptionClass);
+        }
+
+        // 处理征订表子表
+        for (TextbookSubscriptionItem textbookSubscriptionItem : textbookSubscription.getTextbookSubscriptionItemList()) {
+            textbookSubscriptionItem.setTextbookSubscriptionId(textbookSubscription.getId());
+            textbookSubscriptionItemMapper.insert(textbookSubscriptionItem);
         }
 
         return true;
@@ -179,33 +191,16 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean changeStatus(UpdateWfTextbookSubscriptionDto dto) {
-        WfTextbookSubscription wfTextbookSubscription = this.getById(dto.getId());
-        if (wfTextbookSubscription == null) {
+        TextbookSubscription textbookSubscription = textbookSubscriptionMapper.selectById(dto.getId());
+        if (textbookSubscription == null) {
             return false;
         }
-        //点击发起征订
-        if (wfTextbookSubscription.getStatus() == 1 && dto.getStatus() == 2) {
-            WfTextbookSubscription newW = BeanUtil.toBean(dto, WfTextbookSubscription.class);
-            //添加征订记录
-            List<WfTextbookSubscriptionItem> wfTextbookSubscriptionItemList = wfTextbookSubscriptionWfTextbookSubscriptionItemMapper.selectList(Wrappers.<WfTextbookSubscriptionItem>query().lambda().eq(WfTextbookSubscriptionItem::getWfTextbookSubscriptionId, wfTextbookSubscription.getId()));
-            for (WfTextbookSubscriptionItem w : wfTextbookSubscriptionItemList) {
-                textbookTextbookSubscriptionRecordMapper.insert(new TextbookSubscriptionRecord() {{
-                    setCreateDate(new Date());
-                    setTextbookId(w.getTextbookId());
-                    setWfTextbookSubscriptionId(wfTextbookSubscription.getId());
-                    setWfTextbookSubscriptionItemId(w.getId());//该字段存入征订项的id,征订项中有所属征订记录
-                }});
-            }
-            return this.updateById(newW);
-        }
 
+        WfTextbookSubscription newW = new WfTextbookSubscription();
+        newW.setId(textbookSubscription.getId());
+        newW.setStatus(dto.getStatus());
 
-        //点击完成征订
-        if (wfTextbookSubscription.getStatus() == 2 && dto.getStatus() == 4) {
-            WfTextbookSubscription newW = BeanUtil.toBean(dto, WfTextbookSubscription.class);
-            return this.updateById(newW);
-        }
-        return false;
+        return this.updateById(newW);
     }
 
     @Override

+ 139 - 0
src/main/java/com/xjrsoft/module/textbook/vo/TextbookListVo.java

@@ -0,0 +1,139 @@
+package com.xjrsoft.module.textbook.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+* @title: 教材基础信息表分页列表出参
+* @Author dzx
+* @Date: 2024-12-13
+* @Version 1.0
+*/
+@Data
+public class TextbookListVo {
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty("主键编号")
+    private String id;
+    /**
+     * 学科组管理编号(subject_group)
+     */
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private Long subjectGroupId;
+    /**
+     * 学科组名称
+     */
+    @ApiModelProperty("学科组名称")
+    private String groupName;
+    /**
+     * 课程编号(base_course_subject)
+     */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private Long courseSubjectId;
+    /**
+     * 课程
+     */
+    @ApiModelProperty("课程")
+    private String courseName;
+    /**
+     * 使用类型(单位:学期)
+     */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 国际标准书号
+     */
+    @ApiModelProperty("国际标准书号")
+    private String isbn;
+    /**
+     * 书名
+     */
+    @ApiModelProperty("书名")
+    private String bookName;
+    /**
+     * 出版社
+     */
+    @ApiModelProperty("出版社")
+    private String publishingHouse;
+    /**
+     * 主编
+     */
+    @ApiModelProperty("主编")
+    private String editorInChief;
+    /**
+     * 版本
+     */
+    @ApiModelProperty("版本")
+    private String version;
+    /**
+     * 是否为规划教材
+     */
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookType;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型-中文")
+    private String textbookTypeCn;
+    /**
+     * 规格型号
+     */
+    @ApiModelProperty("规格型号")
+    private String specificationsModels;
+    /**
+     * 出版日期
+     */
+    @ApiModelProperty("出版日期")
+    private Date publishingDate;
+    /**
+     * 是否校企合作开发教材
+     */
+    @ApiModelProperty("是否校企合作开发教材")
+    private Integer isSecd;
+    /**
+     * 分类号
+     */
+    @ApiModelProperty("分类号")
+    private String category;
+    /**
+     * 规划批次
+     */
+    @ApiModelProperty("规划批次")
+    private String planBatch;
+    /**
+     * 编著作总数
+     */
+    @ApiModelProperty("编著作总数")
+    private Integer workTotalCount;
+    /**
+     * 教材类型
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookCategory;
+    /**
+     * 定价(元)
+     */
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+    /**
+     * 预估折扣
+     */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
+}

+ 83 - 129
src/main/java/com/xjrsoft/module/textbook/vo/TextbookPageVo.java

@@ -1,192 +1,146 @@
 package com.xjrsoft.module.textbook.vo;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import com.xjrsoft.common.annotation.Trans;
+import com.xjrsoft.common.enums.TransType;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
 import java.math.BigDecimal;
 import java.util.Date;
 
 /**
-* @title: 教材管理分页列表出参
-* @Author szs
-* @Date: 2023-12-25
+* @title: 教材基础信息表分页列表出参
+* @Author dzx
+* @Date: 2024-12-13
 * @Version 1.0
 */
 @Data
 public class TextbookPageVo {
 
     /**
-    * 主键编号
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("主键编号")
+     * 主键编号
+     */
     @ApiModelProperty("主键编号")
     private String id;
     /**
-     * 教材编号
+     * 学科组管理编号(subject_group)
      */
-    @ApiModelProperty("教材编号")
-    private String textbookId;
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private Long subjectGroupId;
+    /**
+     * 学科组名称
+     */
+    @ApiModelProperty("学科组名称")
+    private String groupName;
     /**
-    * 序号
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("序号")
-    @ApiModelProperty("序号")
-    private Integer sortCode;
+     * 课程编号(base_course_subject)
+     */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private Long courseSubjectId;
     /**
-    * 国际标准刊号
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("国际标准刊号")
+     * 课程
+     */
+    @ApiModelProperty("课程")
+    private String courseName;
+    /**
+     * 使用类型(单位:学期)
+     */
+    @ApiModelProperty("使用类型(单位:学期)")
+    private Integer useType;
+    /**
+     * 国际标准刊号
+     */
     @ApiModelProperty("国际标准刊号")
     private String issn;
     /**
-    * 书名
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("书名")
+     * 国际标准书号
+     */
+    @ApiModelProperty("国际标准书号")
+    private String isbn;
+    /**
+     * 书名
+     */
     @ApiModelProperty("书名")
     private String bookName;
     /**
-    * 出版社
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("出版社")
+     * 出版社
+     */
     @ApiModelProperty("出版社")
     private String publishingHouse;
     /**
-    * 主编
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("主编")
+     * 主编
+     */
     @ApiModelProperty("主编")
     private String editorInChief;
     /**
-     * 学科组名称
+     * 版本
      */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学科组名称")
-    @ApiModelProperty("学科组名称")
-    private String groupName;
-
-    /**
-    * 学期名称
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学期名称")
-    @ApiModelProperty("学期名称")
-    private String semesterName;
-    /**
-    * 课程
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("课程")
-    @ApiModelProperty("课程")
-    private String courseName;
-    /**
-    * 版本
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("版本")
     @ApiModelProperty("版本")
     private String version;
     /**
-    * 是否为规划教材
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("是否为规划教材")
+     * 是否为规划教材
+     */
     @ApiModelProperty("是否为规划教材")
-    private String isTextbookPlanCn;
-
+    private Integer isTextbookPlan;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型")
+    private String textbookType;
     /**
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("教材类型")
     @ApiModelProperty("教材类型-中文")
     private String textbookTypeCn;
     /**
-    * 规格型号
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("规格型号")
+     * 规格型号
+     */
     @ApiModelProperty("规格型号")
     private String specificationsModels;
     /**
-    * 估价(元)
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("估价(元)")
-    @ApiModelProperty("估价(元)")
-    private BigDecimal appraisalPrice;
-    /**
-    * 定价(元)
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("定价(元)")
-    @ApiModelProperty("定价(元)")
-    private BigDecimal price;
-    /**
-    * 折扣
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("折扣")
-    @ApiModelProperty("折扣")
-    private Double discount;
-    /**
-    * 小计(元)
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("小计(元)")
-    @ApiModelProperty("小计(元)")
-    private BigDecimal subtotal;
-    /**
-    * 库存
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("库存")
-    @ApiModelProperty("库存")
-    private Integer stock;
-
-    /**
-     * 使用年级
+     * 出版日期
      */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用年级")
-    @ApiModelProperty("使用年级")
-    private String useGrade;
-
-    /**
-     * 使用班级
-     */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用班级")
-    @ApiModelProperty("使用班级")
-    private String useClass;
+    @ApiModelProperty("出版日期")
+    private Date publishingDate;
     /**
-     * 使用类型(单位:学期)
+     * 是否校企合作开发教材
      */
-    @ApiModelProperty("使用类型(单位:学期)")
-    private Integer useType;
-
     @ApiModelProperty("是否校企合作开发教材")
     private Integer isSecd;
-
-    @ApiModelProperty("出版日期")
-    private Date publishingDate;
-
+    /**
+     * 分类号
+     */
     @ApiModelProperty("分类号")
     private String category;
-
+    /**
+     * 规划批次
+     */
     @ApiModelProperty("规划批次")
     private String planBatch;
-
+    /**
+     * 编著作总数
+     */
     @ApiModelProperty("编著作总数")
     private Integer workTotalCount;
-
+    /**
+     * 教材类型
+     */
     @ApiModelProperty("教材类型")
     private String textbookCategory;
+    /**
+     * 定价(元)
+     */
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+    /**
+     * 预估折扣
+     */
+    @ApiModelProperty("预估折扣")
+    private Double discount;
 }

+ 2 - 2
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionListVo.java

@@ -15,9 +15,9 @@ import lombok.Data;
 public class TextbookSubscriptionListVo {
 
     /**
-    * 主键编号
+    * 班级课程主键编号
     */
-    @ApiModelProperty("主键编号")
+    @ApiModelProperty("班级课程主键编号")
     private String id;
     /**
      * 教材编号

+ 56 - 10
src/main/java/com/xjrsoft/module/veb/controller/ImportRubAndHandController.java

@@ -7,9 +7,9 @@ import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.module.generator.entity.ImportConfig;
+import com.xjrsoft.module.textbook.dto.TextbookImportDto;
 import com.xjrsoft.module.veb.service.ImportRubAndHandService;
 import com.xjrsoft.module.veb.vo.BaseCourseSubjectImportVo;
-import com.xjrsoft.module.veb.vo.CompanyCoopImportVo;
 import com.xjrsoft.module.veb.vo.InternshipPlanImportVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +25,8 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -78,6 +80,52 @@ public class ImportRubAndHandController {
         return R.fileStream(bot.toByteArray(), System.currentTimeMillis() + ExcelTypeEnum.XLSX.getValue());
     }
 
+    @PostMapping("/textbook")
+    @ApiOperation(value = "教材信息导入")
+    public RT<Boolean> textbook(@RequestParam MultipartFile file) throws IOException, IllegalAccessException {
+        String result = importRubAndHandService.textbook(file);
+        if (!result.isEmpty()) {
+            throw new MyException(result);
+        }
+        return RT.ok("全部成功", true);
+    }
+
+    @PostMapping("/textbook-template")
+    @ApiOperation(value = "教材信息模板下载")
+    public ResponseEntity<byte[]> textbookTemplate() throws IOException {
+//    @GetMapping("/textbook-template")
+//    @ApiOperation(value = "教材信息模板下载")
+//    public ResponseEntity<byte[]> textbookTemplate() throws IOException {
+        TextbookImportDto obj = new TextbookImportDto();
+        // 开始写入
+        Workbook workbook = new XSSFWorkbook();
+        // 创建一个工作表(sheet)
+        String sheetName = "sheet1";
+        Sheet sheet = workbook.createSheet(sheetName);
+
+        List<ImportConfig> importConfigs = allFields(obj);
+
+        // 标题
+        String title = "教材信息导入模板";
+        createCautionHead(workbook, sheet, 0, title, importConfigs.size() - 1, 36);
+
+        // 提示必填
+        String content = "说明:红底为必填项,白底为非必填项;只有教材分类为教材时才需要填写学科组和对应课程,学科组和课程必须是系统中已添加的信息,且学科组和课程已建立绑定关系;导入时请将示例数据删除,避免导入失败!";
+        createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12);
+
+        // 表头
+        createHead(workbook, sheet, importConfigs, 2);
+
+        //写入文件
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        workbook.write(bot);
+
+
+        String fileName = "教材信息导入模板";
+        fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8);
+        return R.fileStream(bot.toByteArray(), fileName + ExcelTypeEnum.XLSX.getValue());
+    }
+
     private ByteArrayOutputStream writeTemplateSheet(Object obj) throws IOException {
         // 开始写入
         Workbook workbook = new XSSFWorkbook();
@@ -88,10 +136,11 @@ public class ImportRubAndHandController {
         List<ImportConfig> importConfigs = allFields(obj);
 
         // 表头
-        createHead(workbook, sheet, importConfigs);
+        createHead(workbook, sheet, importConfigs, 0);
 
         // 提示必填
-        createCautionHead(workbook, sheet);
+        String content = "红色背景为必填项,导入时请删除本行。";
+        createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12);
 
         //写入文件
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
@@ -132,8 +181,7 @@ public class ImportRubAndHandController {
         return importConfigs;
     }
 
-    private void createHead(Workbook workbook, Sheet sheet, List<ImportConfig> importConfigs) {
-        int rowNumber = 0;
+    private void createHead(Workbook workbook, Sheet sheet, List<ImportConfig> importConfigs, int rowNumber) {
         Font font = workbook.createFont();
         font.setFontName("宋体");
         font.setFontHeightInPoints((short)12);
@@ -169,11 +217,10 @@ public class ImportRubAndHandController {
         }
     }
 
-    private void createCautionHead(Workbook workbook, Sheet sheet) {
-        int rowNumber = 1;
+    private void createCautionHead(Workbook workbook, Sheet sheet, int rowNumber, String content, int lastCol, int size) {
         Font font = workbook.createFont();
         font.setFontName("宋体");
-        font.setFontHeightInPoints((short)12);
+        font.setFontHeightInPoints((short)size);
         font.setColor(IndexedColors.RED.getIndex());
 
         CellStyle cellStyle = workbook.createCellStyle();
@@ -181,9 +228,8 @@ public class ImportRubAndHandController {
 
         Row row = sheet.createRow(rowNumber);
         Cell cell = row.createCell(0);
-        String content = "红色背景为必填项,导入时请删除本行。";
         cell.setCellValue(content);
         cell.setCellStyle(cellStyle);
-        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 5));
+        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, lastCol));
     }
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/veb/service/ImportRubAndHandService.java

@@ -12,4 +12,6 @@ public interface ImportRubAndHandService {
 
     String internshipPlan(MultipartFile file) throws IOException, IllegalAccessException;
 
+    String textbook(MultipartFile file) throws IOException, IllegalAccessException;
+
 }

+ 144 - 5
src/main/java/com/xjrsoft/module/veb/service/impl/ImportRubAndHandServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -15,11 +16,15 @@ import com.xjrsoft.module.base.entity.*;
 import com.xjrsoft.module.base.mapper.*;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.mapper.UserMapper;
-import com.xjrsoft.module.student.entity.BaseMajor;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.entity.DictionaryItem;
 import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
 import com.xjrsoft.module.system.mapper.DictionaryitemMapper;
+import com.xjrsoft.module.textbook.dto.TextbookImportDto;
+import com.xjrsoft.module.textbook.entity.SubjectGroup;
+import com.xjrsoft.module.textbook.entity.Textbook;
+import com.xjrsoft.module.textbook.mapper.SubjectGroupMapper;
+import com.xjrsoft.module.textbook.mapper.TextbookMapper;
 import com.xjrsoft.module.veb.entity.InternshipPlanManage;
 import com.xjrsoft.module.veb.entity.InternshipPlanManageParticipant;
 import com.xjrsoft.module.veb.entity.TrainingOutside;
@@ -32,16 +37,15 @@ import com.xjrsoft.module.veb.service.ImportRubAndHandService;
 import com.xjrsoft.module.veb.vo.BaseCourseSubjectImportVo;
 import com.xjrsoft.module.veb.vo.InternshipPlanImportVo;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
@@ -77,6 +81,10 @@ public class ImportRubAndHandServiceImpl implements ImportRubAndHandService {
 
     private final BaseClassMapper baseClassMapper;
 
+    private final SubjectGroupMapper subjectGroupMapper;
+
+    private final TextbookMapper textbookMapper;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String courseSubject(MultipartFile file) throws IOException, IllegalAccessException {
@@ -457,6 +465,137 @@ public class ImportRubAndHandServiceImpl implements ImportRubAndHandService {
         return sb.toString();
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String textbook(MultipartFile file) throws IOException, IllegalAccessException {
+        List<TextbookImportDto> excelDataList = EasyExcel.read(file.getInputStream()).headRowNumber(3).head(TextbookImportDto.class).sheet().doReadSync();
+        StringBuilder sb = new StringBuilder();
+
+        List<String> codeList = new ArrayList<>();
+        codeList.add("textbook_type");
+        codeList.add("textbook_category");
+
+        Map<String, String> dictionary = initDictionary(codeList);
+
+        //查询所有需要的数据
+        //学科组
+        List<SubjectGroup> subjectGroupList = subjectGroupMapper.selectList(
+                Wrappers
+                        .lambdaQuery(SubjectGroup.class)
+                        .eq(SubjectGroup::getDeleteMark, DeleteMark.NODELETE.getCode()));
+        Map<String, Long> subjectGroupNameAndIdMap = subjectGroupList.stream().collect(Collectors.toMap(SubjectGroup::getGroupName, SubjectGroup::getId, (k1, k2) -> k1));
+
+        //使用课程
+        List<BaseCourseSubject> baseCourseSubjectList = baseCourseSubjectMapper.selectList(
+                Wrappers
+                        .lambdaQuery(BaseCourseSubject.class)
+                        .eq(BaseCourseSubject::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        Map<String, Long> baseCourseSubjectNameAndIdMap = baseCourseSubjectList.stream().collect(Collectors.toMap(BaseCourseSubject::getName, BaseCourseSubject::getId, (k1, k2) -> k1));
+
+        List<Textbook> insertTextbooks = new ArrayList<>();
+        List<Textbook> updateTextbooks = new ArrayList<>();
+        for (int i = 0; i < excelDataList.size(); i++) {
+            TextbookImportDto dto = excelDataList.get(i);
+            if (isRequiredFieldsFilled(dto,
+                    sb,
+                    i)) {
+                return sb.toString();
+            }
+
+            Textbook textbook = new Textbook();
+            BeanUtils.copyProperties(dto, textbook);
+
+            // 验证字段的合理性
+            // 字典类型
+            if (validateAndSetDictionaryField(dto::getTextbookTypeCn,
+                    "textbook_type",
+                    "教材分类(教材、辅材、作业本)",
+                    dictionary,
+                    textbook::setTextbookType,
+                    sb,
+                    i)) {
+                return sb.toString();
+            }
+            if (validateAndSetDictionaryField(dto::getTextbookCategory,
+                    "textbook_category",
+                    "教材类型(纸质教材、数字教材、纸质与数字资源结合教材)",
+                    dictionary,
+                    textbook::setTextbookCategory,
+                    sb,
+                    i)) {
+                return sb.toString();
+            }
+
+            // 关联表
+            if (validateAndSetString2LongField(dto::getGroupName,
+                    "学科组(必须是系统中已有的学科组名称)",
+                    subjectGroupNameAndIdMap,
+                    textbook::setSubjectGroupId,
+                    sb,
+                    i
+            )) {
+                return sb.toString();
+            }
+            if (validateAndSetString2LongField(dto::getCourseName,
+                    "对应课程(必须是系统中已有的课程名称)",
+                    baseCourseSubjectNameAndIdMap,
+                    textbook::setCourseSubjectId,
+                    sb,
+                    i
+            )) {
+                return sb.toString();
+            }
+
+            // 处理是否教材计划字段
+            String isTextbookPlanCn = dto.getIsTextbookPlanCn();
+            Integer isTextbookPlan = Optional.ofNullable(isTextbookPlanCn)
+                    .filter("是"::equals)
+                    .map(s -> 1)
+                    .orElse(0);
+            textbook.setIsTextbookPlan(isTextbookPlan);
+
+            String isSecd = dto.getIsSecd();
+            Integer isSecdI = Optional.ofNullable(isSecd)
+                    .filter("是"::equals)
+                    .map(s -> 1)
+                    .orElse(0);
+            textbook.setIsSecd(isSecdI);
+
+            // 判断导入的教材是否已经存在,根据教材的 ISSN 码和使用的学科组和课程判断
+            LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            textbookLambdaQueryWrapper
+                    .eq(Textbook::getIssn, textbook.getIssn())
+                    .eq(Textbook::getSubjectGroupId, textbook.getSubjectGroupId())
+                    .eq(Textbook::getCourseSubjectId, textbook.getCourseSubjectId())
+                    .eq(Textbook::getDeleteMark, DeleteMark.NODELETE.getCode())
+            ;
+
+            Textbook verifyTextbook = textbookMapper.selectOne(textbookLambdaQueryWrapper);
+            if(ObjectUtils.isNotEmpty(verifyTextbook)){
+                textbook.setId(verifyTextbook.getId());
+                updateTextbooks.add(textbook);
+            }else {
+                insertTextbooks.add(textbook);
+            }
+        }
+
+        //批量新增
+        if (!insertTextbooks.isEmpty()) {
+            for (Textbook textbook : insertTextbooks) {
+                textbookMapper.insert(textbook);
+            }
+        }
+
+        //批量修改
+        if (!updateTextbooks.isEmpty()) {
+            for (Textbook textbook : updateTextbooks) {
+                textbookMapper.updateById(textbook);
+            }
+        }
+        return sb.toString();
+    }
+
     private boolean validateAndSetString2LongField(Supplier<String> getter,
                                                    String fieldName,
                                                    Map<String, Long> string2Long,

+ 195 - 133
src/main/resources/sqlScript/textbook_sql.sql

@@ -1,52 +1,185 @@
 -- ----------------------------
 -- 2024-12-13 14:36
--- 教材信息表
+-- 教材基础信息表
 -- ----------------------------
-DROP TABLE IF EXISTS textbook;
-CREATE TABLE `textbook`
+drop table if exists textbook;
+create table `textbook`
 (
-    id                         bigint         not null comment '主键编号'
-    primary key,
-    create_user_id             bigint         null comment '创建人',
-    create_date                datetime       null comment '创建时间',
-    modify_user_id             bigint         null comment '修改人',
-    modify_date                datetime       null comment '修改时间',
-    delete_mark                int            not null comment '删除标记',
-    enabled_mark               int            not null comment '有效标志',
-    sort_code                  int            null comment '序号',
-    issn                       varchar(200)   null comment '国际标准刊号',
-    isbn                       varchar(200)   null comment '国际标准书号',
-    book_name                  varchar(200)   null comment '书名',
-    publishing_house           varchar(200)   null comment '出版社',
-    editor_in_chief            varchar(200)   null comment '主编',
-    subject_group_id           bigint         null comment '学科组管理编号(subject_group)',
-    base_semester_id           bigint         null comment '学期ID(base_semester)',
-    course_subject_id          bigint         null comment '课程编号(base_course_subject)',
-    grade_id                   bigint         null comment '入学年级(base_grade)',
-    version                    varchar(100)   null comment '版本',
-    is_textbook_plan           varchar(20)    null comment '是否为规划教材(xjr_dictionary_item[judgment_method_1])',
-    textbook_type              varchar(20)    null comment '教材分类(xjr_dictionary_item[textbook_type])',
-    specifications_models      varchar(100)   null comment '规格型号',
-    appraisal_price            decimal(10, 2) null comment '估价(元)',
-    price                      decimal(10, 2) null comment '定价(元)',
-    discount                   float          null comment '折扣',
-    subtotal                   decimal(10, 2) null comment '小计(元)',
-    stock                      int            null comment '库存',
-    textbook_core_attribute_id bigint         not null comment '教材核心信息管理id(textbook_core_attribute)',
-    use_type                   int            null comment '使用类型(单位:学期)',
-    publishing_date            datetime       null comment '出版日期',
-    is_secd                    int            null comment '是否校企合作开发教材',
-    category                   varchar(50)    null comment '分类号',
-    plan_batch                 varchar(50)    null comment '规划批次',
-    work_total_count           int            null comment '编著作总数',
-    textbook_category          varchar(30)    null comment '教材类型'
-    )
-    comment '教材管理';
+    id                    bigint         not null comment '主键编号'
+        primary key,
+    create_user_id        bigint         null comment '创建人',
+    create_date           datetime       null comment '创建时间',
+    modify_user_id        bigint         null comment '修改人',
+    modify_date           datetime       null comment '修改时间',
+    delete_mark           int            not null comment '删除标记',
+    enabled_mark          int            not null comment '有效标志',
+    sort_code             int            null comment '序号',
+
+    subject_group_id      bigint         not null comment '学科组管理编号(subject_group)',
+    course_subject_id     bigint         not null comment '课程编号(base_course_subject)',
+    use_type              int            null default 1 comment '使用类型(单位:学期)',
+
+    issn                  varchar(200)   not null unique comment '国际标准刊号',
+    isbn                  varchar(200)   not null unique comment '国际标准书号',
+    book_name             varchar(200)   not null comment '书名',
+    publishing_house      varchar(200)   null default '/' comment '出版社',
+    editor_in_chief       varchar(200)   null default '/' comment '主编',
+    version               varchar(100)   null default '/' comment '版本',
+    is_textbook_plan      int            null default 0 comment '是否为规划教材',
+    textbook_type         varchar(20)    null comment '教材分类(xjr_dictionary_item[textbook_type])',
+    specifications_models varchar(100)   null default '/' comment '规格型号',
+    publishing_date       datetime       null comment '出版日期',
+    is_secd               int            null default 0 comment '是否校企合作开发教材',
+    category              varchar(50)    null default '/' comment '分类号',
+    plan_batch            varchar(50)    null default '/' comment '规划批次',
+    work_total_count      int            null default 0 comment '编著作总数',
+    textbook_category     varchar(30)    null default '/' comment '教材类型',
+    price                 decimal(10, 2) null default 0 comment '定价(元)',
+    discount              float          null default 10 comment '预估折扣'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材基础信息表';
+
+-- ----------------------------
+-- 2024-12-13 14:36
+-- 教材征订记录表
+-- ----------------------------
+drop table if exists textbook_subscription;
+create table `textbook_subscription`
+(
+    id                  bigint        not null comment '主键编号'
+        primary key,
+    create_user_id      bigint        null comment '创建人',
+    create_date         datetime      null comment '创建时间',
+    modify_user_id      bigint        null comment '修改人',
+    modify_date         datetime      null comment '修改时间',
+    delete_mark         int           not null comment '删除标记',
+    enabled_mark        int           not null comment '有效标志',
+    sort_code           int           null comment '序号',
+    remark              varchar(1000) null comment '备注',
+
+    base_semester_id    bigint        not null comment '学期id(base_semester)',
+    subscription_method int           not null comment '征订方式(1:按班级征订 2:按教材征订)',
+    base_class_ids      varchar(1000) null comment '按班级征订征订的班级主键(base_class)',
+    sum                 int           null default 0 comment '征订教材总数',
+    status              int           null default 0 comment '征订状态(1:结束 0:未结束)'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材教辅征订记录表';
+
+-- ----------------------------
+-- 2024-12-13 14:36
+-- 教材征订记录与班级关联表
+-- ----------------------------
+drop table if exists textbook_subscription_class;
+create table `textbook_subscription_class`
+(
+    id                       bigint        not null comment '主键编号'
+        primary key,
+    create_user_id           bigint        null comment '创建人',
+    create_date              datetime      null comment '创建时间',
+    modify_user_id           bigint        null comment '修改人',
+    modify_date              datetime      null comment '修改时间',
+    delete_mark              int           not null comment '删除标记',
+    enabled_mark             int           not null comment '有效标志',
+    sort_code                int           null comment '序号',
+    remark                   varchar(1000) null comment '备注',
+
+    textbook_subscription_id bigint        not null comment '教材征订记录表id(textbook_subscription)',
+    base_class_id            bigint        not null comment '按班级征订中征订的班级主键(base_class)'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材征订记录与班级关联表';
+
+-- ----------------------------
+-- 2024-12-13 14:36
+-- 教材征订记录详情表
+-- ----------------------------
+drop table if exists textbook_subscription_item;
+create table `textbook_subscription_item`
+(
+    id                       bigint         not null comment '主键编号'
+        primary key,
+    create_user_id           bigint         null comment '创建人',
+    create_date              datetime       null comment '创建时间',
+    modify_user_id           bigint         null comment '修改人',
+    modify_date              datetime       null comment '修改时间',
+    delete_mark              int            not null comment '删除标记',
+    enabled_mark             int            not null comment '有效标志',
+    sort_code                int            null comment '序号',
+
+    textbook_subscription_id bigint         not null comment '教材教辅增订记录表主键(textbook_subscription)',
+    textbook_id              bigint         null comment '教材表主键(textbook)',
+
+    student_num              int            null default 0 comment '学生用书征订数量',
+    teacher_num              int            null default 0 comment '教师用书征订数量',
+    discount                 float          null default 10 comment '实际折扣',
+    price                    decimal(10, 2) null default 0 comment '实际价格(元)',
+    in_stock_num             int            null default 0 comment '当前征订任务征订项入库数量',
+    out_stock_num            int            null default 0 comment '当前征订任务征订项出库数量',
+    alteration_type          int            null default 0 comment '变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,)'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材征订记录详情表';
+
+-- ----------------------------
+-- 2024-12-13 14:36
+-- 教材征订记录详情变更记录表
+-- ----------------------------
+drop table if exists textbook_subscription_item_history;
+create table `textbook_subscription_item_history`
+(
+    id                            bigint         not null comment '主键编号'
+        primary key,
+    create_user_id                bigint         null comment '创建人',
+    create_date                   datetime       null comment '创建时间',
+    modify_user_id                bigint         null comment '修改人',
+    modify_date                   datetime       null comment '修改时间',
+    delete_mark                   int            not null comment '删除标记',
+    enabled_mark                  int            not null comment '有效标志',
+    sort_code                     int            null comment '序号',
+
+    textbook_subscription_id      bigint         not null comment '教材教辅征订编号',
+    textbook_subscription_item_id bigint         not null comment '教材教辅征订项编号',
+
+    textbook_id                   bigint         null comment '教材表主键(textbook)',
+
+    student_num                   int            null default 0 comment '学生用书征订数量',
+    teacher_num                   int            null default 0 comment '教师用书征订数量',
+    discount                      float          null default 10 comment '实际折扣',
+    price                         decimal(10, 2) null default 0 comment '实际价格(元)',
+    in_stock_num                  int            null default 0 comment '当前征订任务征订项入库数量',
+    out_stock_num                 int            null default 0 comment '当前征订任务征订项出库数量',
+    alteration_type               int            null default 0 comment '变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,)'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材教辅征订项变更历史';
+
+
+drop table if exists textbook_subscription_record;
+create table `textbook_subscription_record`
+(
+    id                               bigint   not null comment '主键编号'
+        primary key,
+    create_user_id                   bigint   null comment '创建人',
+    create_date                      datetime null comment '创建时间',
+    modify_user_id                   bigint   null comment '修改人',
+    modify_date                      datetime null comment '修改时间',
+    delete_mark                      int      not null comment '删除标记',
+    enabled_mark                     int      not null comment '有效标志',
+    sort_code                        int      null comment '序号',
+
+    textbook_subscription_id      bigint   null comment '教材征订编号',
+    textbook_subscription_item_id bigint   null comment '教材征订项编号'
+) engine = innodb
+  default charset = utf8mb4
+  collate = utf8mb4_0900_ai_ci comment ='教材征订记录';
+
 
 create table if not exists tl.textbook_claim_user
 (
     id                   bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id       bigint        null comment '创建人',
     create_date          datetime      null comment '创建时间',
     modify_user_id       bigint        null comment '修改人',
@@ -63,7 +196,7 @@ create table if not exists tl.textbook_claim_user
 create table if not exists tl.textbook_class_relation
 (
     id             bigint   not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id bigint   null comment '创建人',
     create_date    datetime null comment '创建时间',
     modify_user_id bigint   null comment '修改人',
@@ -79,7 +212,7 @@ create table if not exists tl.textbook_class_relation
 create table if not exists tl.textbook_core_attribute
 (
     id               bigint       not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id   bigint       null comment '创建人',
     create_date      datetime     null comment '创建时间',
     modify_user_id   bigint       null comment '修改人',
@@ -92,13 +225,13 @@ create table if not exists tl.textbook_core_attribute
     book_name        varchar(200) null comment '书名',
     publishing_house varchar(200) null comment '出版社',
     editor_in_chief  varchar(200) null comment '主编'
-    )
+)
     comment '教材核心信息管理';
 
 create table if not exists tl.textbook_issue_record
 (
     id               bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id   bigint        null comment '创建人',
     create_date      datetime      null comment '创建时间',
     modify_user_id   bigint        null comment '修改人',
@@ -115,13 +248,13 @@ create table if not exists tl.textbook_issue_record
     issue_user_id    bigint        null comment '出库用户编号',
     issue_mode       varchar(20)   null comment '出库方式(xjr_dictionary_item[issue_mode])',
     remark           varchar(1000) null comment '备注'
-    )
+)
     comment '教材出库记录';
 
 create table if not exists tl.textbook_student_claim
 (
     id               bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id   bigint        null comment '创建人',
     create_date      datetime      null comment '创建时间',
     modify_user_id   bigint        null comment '修改人',
@@ -129,36 +262,19 @@ create table if not exists tl.textbook_student_claim
     delete_mark      int           not null comment '删除标记',
     enabled_mark     int           not null comment '有效标志',
     sort_code        int           null comment '序号',
-    base_semester_id bigint        null comment '学期ID(base_semester)',
+    base_semester_id bigint        null comment '学期id(base_semester)',
     class_id         bigint        null comment '班级编号',
     student_user_id  bigint        null comment '学生用户编号',
     textbook_id      bigint        null comment '教材管理编号',
     is_claim         int default 0 not null comment '是否领取(1:已领取 0:未领取)',
     remark           varchar(1000) null comment '备注'
-    )
-    comment '学生教材认领记录';
-
-create table if not exists tl.textbook_subscription_record
-(
-    id                               bigint   not null comment '主键编号'
-    primary key,
-    create_user_id                   bigint   null comment '创建人',
-    create_date                      datetime null comment '创建时间',
-    modify_user_id                   bigint   null comment '修改人',
-    modify_date                      datetime null comment '修改时间',
-    delete_mark                      int      not null comment '删除标记',
-    enabled_mark                     int      not null comment '有效标志',
-    sort_code                        int      null comment '序号',
-    textbook_id                      bigint   null comment '教材管理编号',
-    wf_textbook_subscription_id      bigint   null comment '教材教辅征订编号',
-    wf_textbook_subscription_item_id bigint   null comment '教材教辅征订项编号'
 )
-    comment '教材征订记录';
+    comment '学生教材认领记录';
 
 create table if not exists tl.textbook_warehouse_record
 (
     id               bigint         not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id   bigint         null comment '创建人',
     create_date      datetime       null comment '创建时间',
     modify_user_id   bigint         null comment '修改人',
@@ -177,13 +293,13 @@ create table if not exists tl.textbook_warehouse_record
     total_price      decimal(10, 2) null comment '总价(元)',
     warehouse_mode   varchar(20)    null comment '入库方式(xjr_dictionary_item[warehouse_mode])',
     remark           varchar(1000)  null comment '备注'
-    )
+)
     comment '教材入库记录';
 
 create table if not exists tl.wf_textbook_claim
 (
     id                bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id    bigint        null comment '创建人',
     create_date       datetime      null comment '创建时间',
     modify_user_id    bigint        null comment '修改人',
@@ -193,7 +309,7 @@ create table if not exists tl.wf_textbook_claim
     sort_code         int           null comment '序号',
     applicant_user_id bigint        null comment '申请人',
     class_id          bigint        null comment '班级编号',
-    base_semester_id  bigint        null comment '学期ID(base_semester)',
+    base_semester_id  bigint        null comment '学期id(base_semester)',
     student_user_id   bigint        null comment '学生编号',
     claim_address     varchar(1000) null comment '领取地点',
     claim_type        varchar(20)   null comment '申领类型(xjr_dictionary_item[claim_type])',
@@ -201,13 +317,13 @@ create table if not exists tl.wf_textbook_claim
     claim_user_id     bigint        null comment '领取用户编号(申请人帮领取人申请去领取)',
     status            int default 0 not null comment '状态(1:结束 0:未结束)',
     textbook_type     varchar(20)   null comment '教材分类(xjr_dictionary_item[textbook_type])'
-    )
+)
     comment '教材申领';
 
 create table if not exists tl.wf_textbook_claim_item
 (
     id                   bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id       bigint        null comment '创建人',
     create_date          datetime      null comment '创建时间',
     modify_user_id       bigint        null comment '修改人',
@@ -225,7 +341,7 @@ create table if not exists tl.wf_textbook_claim_item
 create table if not exists tl.wf_textbook_recede
 (
     id                bigint        not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id    bigint        null comment '创建人',
     create_date       datetime      null comment '创建时间',
     modify_user_id    bigint        null comment '修改人',
@@ -234,18 +350,18 @@ create table if not exists tl.wf_textbook_recede
     enabled_mark      int           not null comment '有效标志',
     sort_code         int           null comment '序号',
     applicant_user_id bigint        null comment '申请人',
-    base_semester_id  bigint        null comment '学期ID(base_semester)',
+    base_semester_id  bigint        null comment '学期id(base_semester)',
     class_id          bigint        null comment '班级编号',
     recede_type       varchar(20)   null comment '退书类型(xjr_dictionary_item[recede_type])',
     recede_address    varchar(1000) null comment '退还地点',
     status            int default 0 not null comment '状态(1:结束 0:未结束)'
-    )
+)
     comment '退书申请';
 
 create table if not exists tl.wf_textbook_recede_item
 (
     id                    bigint   not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id        bigint   null comment '创建人',
     create_date           datetime null comment '创建时间',
     modify_user_id        bigint   null comment '修改人',
@@ -259,31 +375,10 @@ create table if not exists tl.wf_textbook_recede_item
 )
     comment '退书申请项';
 
-create table if not exists tl.wf_textbook_subscription
-(
-    id                  bigint        not null comment '主键编号'
-    primary key,
-    create_user_id      bigint        null comment '创建人',
-    create_date         datetime      null comment '创建时间',
-    modify_user_id      bigint        null comment '修改人',
-    modify_date         datetime      null comment '修改时间',
-    delete_mark         int           not null comment '删除标记',
-    enabled_mark        int           not null comment '有效标志',
-    sort_code           int           null comment '序号',
-    applicant_user_id   bigint        null comment '申请人',
-    dept_id             bigint        null comment '所在部门编号',
-    base_semester_id    bigint        null comment '学期ID(base_semester)',
-    subject_group_id    bigint        null comment '学科组管理编号(subject_group)',
-    remark              varchar(1000) null comment '备注',
-    status              int default 0 not null comment '状态(1:结束 0:未结束)',
-    subscription_method int           null comment '征订方式(1:按班级征订 2:按教材征订)'
-    )
-    comment '教材教辅征订';
-
 create table if not exists tl.wf_textbook_subscription_item
 (
     id                          bigint         not null comment '主键编号'
-    primary key,
+        primary key,
     create_user_id              bigint         null comment '创建人',
     create_date                 datetime       null comment '创建时间',
     modify_user_id              bigint         null comment '修改人',
@@ -310,41 +405,8 @@ create table if not exists tl.wf_textbook_subscription_item
     textbook_id                 bigint         null comment '教材id',
     in_stockroom_num            int default 0  null comment '当前征订任务征订项已经入库数量',
     alteration_type             int default 0  null comment '变更类型(0:未变更,1:变更征订数量,2:变更课程)'
-    )
+)
     comment '教材教辅征订项';
 
-create table if not exists tl.wf_textbook_subscription_item_history
-(
-    id                               bigint         not null comment '主键编号'
-    primary key,
-    create_user_id                   bigint         null comment '创建人',
-    create_date                      datetime       null comment '创建时间',
-    modify_user_id                   bigint         null comment '修改人',
-    modify_date                      datetime       null comment '修改时间',
-    delete_mark                      int            not null comment '删除标记',
-    enabled_mark                     int            not null comment '有效标志',
-    sort_code                        int            null comment '序号',
-    wf_textbook_subscription_item_id bigint         null comment '教材教辅征订项编号',
-    wf_textbook_subscription_id      bigint         null comment '教材教辅征订编号',
-    subscription_type                varchar(20)    null comment '征订类型(xjr_dictionary_item[subscription_type])',
-    issn                             varchar(200)   null comment '国际标准刊号',
-    isbn                             varchar(200)   null comment '国际标准书号',
-    book_name                        varchar(200)   null comment '书名',
-    publishing_house                 varchar(200)   null comment '出版社',
-    editor_in_chief                  varchar(200)   null comment '主编',
-    appraisal_price                  decimal(10, 2) null comment '估价(元)',
-    is_textbook_plan                 varchar(20)    null comment '是否为规划教材(xjr_dictionary_item[judgment_method_1])',
-    course_subject_id                bigint         null comment '课程编号(base_course_subject)',
-    class_ids                        varchar(1000)  null comment '班级编号(多个)',
-    student_subscription_number      int            null comment '学生用书征订数量',
-    teacher_subscription_number      int            null comment '教师教材征订数量',
-    teacher_reference_number         int            null comment '教师教参用书征订数量',
-    is_support_resources             varchar(20)    null comment '是否有配套教学资源(xjr_dictionary_item[judgment_method_1])',
-    version                          varchar(100)   null comment '版本',
-    textbook_id                      bigint         null comment '教材id',
-    in_stockroom_num                 int default 0  null comment '当前征订任务征订项已经入库数量',
-    alteration_type                  int default 0  null comment '变更类型(0:未变更,1:变更征订数量,2:变更课程)',
-    history_version                  int default 1  null comment '当前征订任务征订项已经入库数量'
-    )
-    comment '教材教辅征订项变更历史';
+
 

+ 78 - 19
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -1237,33 +1237,33 @@ public class FreeMarkerGeneratorTest {
         mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
         tableConfigs.add(mainTable);
 
-        mainTable = new TableConfig();
-        mainTable.setTableName("textbook_class_relation");//init_sql中的表名
-        mainTable.setIsMain(false);//是否是主表,一般默认为true
-        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
-        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
-        mainTable.setRelationField("textbook_id");//设置外键
-        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
-        tableConfigs.add(mainTable);
-
-        mainTable = new TableConfig();
-        mainTable.setTableName("textbook_subscription_record");//init_sql中的表名
-        mainTable.setIsMain(false);//是否是主表,一般默认为true
-        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
-        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
-        mainTable.setRelationField("wf_textbook_subscription_id");//设置外键
-        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
-        tableConfigs.add(mainTable);
+//        mainTable = new TableConfig();
+//        mainTable.setTableName("textbook_class_relation");//init_sql中的表名
+//        mainTable.setIsMain(false);//是否是主表,一般默认为true
+//        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+//        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+//        mainTable.setRelationField("textbook_id");//设置外键
+//        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+//        tableConfigs.add(mainTable);
+//
+//        mainTable = new TableConfig();
+//        mainTable.setTableName("textbook_subscription_record");//init_sql中的表名
+//        mainTable.setIsMain(false);//是否是主表,一般默认为true
+//        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+//        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+//        mainTable.setRelationField("wf_textbook_subscription_id");//设置外键
+//        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+//        tableConfigs.add(mainTable);
 
 
         ApiGenerateCodesDto params = new ApiGenerateCodesDto();
-        params.setAuthor("szs");//作者名称
+        params.setAuthor("dzx");//作者名称
         params.setPackageName("textbook");//包名
         params.setTableConfigs(tableConfigs);
         params.setPage(true);//是否生成分页接口
         params.setImport(false);//是否生成导入接口
         params.setExport(true);//是否生成导出接口
-        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setOutMainDir(false);//是否生成在主目录,前期测试可设置成false
         params.setDs(ds);
 
         IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
@@ -4062,4 +4062,63 @@ public class FreeMarkerGeneratorTest {
 
         apiGeneratorService.generateCodes(params);
     }
+
+    @Test
+    public void gcTextbookSubscription() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("textbook_subscription");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        mainTable = new TableConfig();
+        mainTable.setTableName("textbook_subscription_item");//init_sql中的表名
+        mainTable.setIsMain(false);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        mainTable.setRelationField("textbook_subscription_id");//设置外键
+        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("textbook");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(false);//是否生成分页接口
+        params.setImport(true);//是否生成导入接口
+        params.setExport(true);//是否生成导出接口
+        params.setOutMainDir(false);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
+
+    @Test
+    public void gcTextbookSubscriptionClass() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("textbook_subscription_class");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("textbook");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(false);//是否生成分页接口
+        params.setImport(true);//是否生成导入接口
+        params.setExport(true);//是否生成导出接口
+        params.setOutMainDir(false);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
 }

+ 5 - 5
src/test/java/com/xjrsoft/xjrsoftboot/TextBookTest.java

@@ -112,16 +112,16 @@ public class TextBookTest {
 
             Object yesno = dataMap.get(9);
             if(yesno != null){
-                textbook.setIsTextbookPlan(yesno.toString());
+//                textbook.setIsTextbookPlan(yesno.toString());
             }
             if(dataMap.get(13) != null){
                 textbook.setSubjectGroupId(subjectGroupMap.get(dataMap.get(13).toString()));
             }
             if(dataMap.get(11) != null){
-                textbook.setGradeId(gaseGradeMap.get(dataMap.get(11).toString()));
+//                textbook.setGradeId(gaseGradeMap.get(dataMap.get(11).toString()));
             }
 
-            textbook.setBaseSemesterId(1754815042567057408L);
+//            textbook.setBaseSemesterId(1754815042567057408L);
             if(dataMap.get(10) != null){
                 textbook.setCourseSubjectId(courseSubjectMap.get(dataMap.get(10).toString()));
             }
@@ -147,8 +147,8 @@ public class TextBookTest {
                 }
 
             }
-            textbook.setTextbookClassRelationList(relationList);
-            textbookService.add(textbook);
+//            textbook.setTextbookClassRelationList(relationList);
+//            textbookService.add(textbook);
 
         }
     }