Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into pre

dzx 1 rok pred
rodič
commit
884986162b
18 zmenil súbory, kde vykonal 378 pridanie a 296 odobranie
  1. 1 1
      src/main/java/com/xjrsoft/common/interceptor/RateLimitInterceptor.java
  2. 1 86
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java
  3. 2 14
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookIssueRecordController.java
  4. 5 8
      src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionController.java
  5. 2 0
      src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionItemHistoryController.java
  6. 5 0
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookInstockroomDto.java
  7. 26 0
      src/main/java/com/xjrsoft/module/textbook/dto/TextbookInstockroomImportDto.java
  8. 46 0
      src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionDto.java
  9. 10 0
      src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionItemHistoryPageDto.java
  10. 1 1
      src/main/java/com/xjrsoft/module/textbook/service/ITextbookService.java
  11. 2 2
      src/main/java/com/xjrsoft/module/textbook/service/IWfTextbookSubscriptionService.java
  12. 100 52
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java
  13. 56 87
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java
  14. 21 5
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookClaimExportQueryVo.java
  15. 40 4
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionExportQueryListVo.java
  16. 36 27
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionExportQueryVo.java
  17. 1 1
      src/main/resources/application.yml
  18. 23 8
      src/main/resources/mapper/textbook/TextbookMapper.xml

+ 1 - 1
src/main/java/com/xjrsoft/common/interceptor/RateLimitInterceptor.java

@@ -38,7 +38,7 @@ public class RateLimitInterceptor implements HandlerInterceptor {
         Long userType = Convert.toLong(StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_TYPE), 0L);
         if (userType.equals(RoleEnum.STUDENT.getCode())) {
             Map map = redisUtil.get(GlobalConstant.WHITE_MANAGEMENT_CACHE_KEY, Map.class);
-            return map.get(userId) == null;
+            return map.get(userId.toString()) == null;
         }
         return false;
     }

+ 1 - 86
src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java

@@ -309,93 +309,8 @@ public class TextbookController {
 //    @GetMapping("/textbook-subscription-export-query")
 //    @ApiOperation(value = "教材征订记录条件导出")
 //    public ResponseEntity<byte[]> textbookSubscriptionExportQuery(@Valid TextbookSubscriptionExportQueryDto dto) {
-        List<TextbookSubscriptionExportQueryVo> customerList = textbookService.listTextbookSubscriptionExportQuery(dto);
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-
-        // 设置动态头
-        String baseSemesterCn = "";
-        if(dto.getBaseSemesterId() != null){
-            LambdaQueryWrapper<BaseSemester> baseSemesterLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            baseSemesterLambdaQueryWrapper
-                    .eq(BaseSemester::getId, dto.getBaseSemesterId());
-            BaseSemester baseSemester = baseSemesterService.getOne(baseSemesterLambdaQueryWrapper);
-            if(baseSemester != null){
-                baseSemesterCn = baseSemester.getName();
-            }
-        }
-        String headTitle = "重庆市铜梁职业教育中心" + baseSemesterCn + "教材征订表";
-        List<List<String>> headList = new ArrayList<>();
-//        List<String> head0 = new ArrayList<>();
-//        head0.add("个人信息");
-//        head0.add("用户名");
-//        List<String> head1 = new ArrayList<>();
-//        head1.add("个人信息");
-//        head1.add("年龄");
-//        List<String> head2 = new ArrayList<>();
-//        head2.add("个人信息");
-//        head2.add("地址");
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("国际标准刊号");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("书名");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("出版社");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("主编");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("估价(元)");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("是否为规划教材");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("对应课程");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("使用年级");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("使用班级");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("学生用书征订数量");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("教师教材用书征订数量");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("教师教参用书征订数量");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("学科组名称");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("有无配套教学资源");
-        }});
-        headList.add(new ArrayList<String>(){{
-            add(headTitle);
-            add("备注");
-        }});
-        EasyExcel.write(bot, TextbookSubscriptionExportQueryVo.class).automaticMergeHead(true).excelType(ExcelTypeEnum.XLSX).head(headList).sheet().doWrite(customerList);
 
+        ByteArrayOutputStream bot = textbookService.listTextbookSubscriptionExportQuery(dto);
         return RT.fileStream(bot.toByteArray(), "TextbookSubscription" + ExcelTypeEnum.XLSX.getValue());
     }
 

+ 2 - 14
src/main/java/com/xjrsoft/module/textbook/controller/TextbookIssueRecordController.java

@@ -20,18 +20,9 @@ import com.xjrsoft.module.textbook.vo.TextbookIssueRecordVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.ServletContext;
+import org.springframework.web.bind.annotation.*;
+
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
@@ -53,9 +44,6 @@ public class TextbookIssueRecordController {
 
     private final ITextbookIssueRecordService textbookIssueRecordService;
 
-    @Autowired
-    private ServletContext servletContext;
-
     @GetMapping(value = "/page")
     @ApiOperation(value="教材出库记录列表(分页)")
     @SaCheckPermission("textbookissuerecord:detail")

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

@@ -186,8 +186,8 @@ public class WfTextbookSubscriptionController {
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询教材教辅征订信息")
     @SaCheckPermission("wftextbooksubscription:detail")
-    public RT<WfTextbookSubscriptionVo> info(@RequestParam Long id){
-        WfTextbookSubscriptionVo wfTextbookSubscriptionVo = wfTextbookSubscriptionService.getInfo(id);
+    public RT<WfTextbookSubscriptionVo> info(@Valid WfTextbookSubscriptionDto dto){
+        WfTextbookSubscriptionVo wfTextbookSubscriptionVo = wfTextbookSubscriptionService.getInfo(dto);
         if (wfTextbookSubscriptionVo == null) {
            return RT.error("找不到此数据!");
         }
@@ -246,9 +246,7 @@ public class WfTextbookSubscriptionController {
 
         return RT.fileStream(bot.toByteArray(), "WfTextbookSubscription" + ExcelTypeEnum.XLSX.getValue());
     }
-
-
-
+    
     @PostMapping("/textbook-subscription-export-query")
     @ApiOperation(value = "教材征订条件导出")
     public ResponseEntity<byte[]> textbookSubscriptionExportQuery(@Valid @RequestBody TextbookSubscriptionExportQueryListDto dto) {
@@ -264,9 +262,8 @@ public class WfTextbookSubscriptionController {
 
     @PostMapping("/instockroom-excel-import")
     @ApiOperation(value = "教材征订入库数量导入")
-    @SaCheckPermission("coursetable:excelimport")
-    public R excelImport(@RequestParam("file") MultipartFile file) throws IOException {
+    public R excelImport(@RequestParam("file") MultipartFile file,  @RequestParam(value = "wfTextbookSubscriptionId") Long wfTextbookSubscriptionId) throws IOException {
         InputStream inputStream = file.getInputStream();
-        return R.ok(wfTextbookSubscriptionService.excelImport(inputStream));
+        return R.ok(wfTextbookSubscriptionService.excelImport(inputStream, wfTextbookSubscriptionId));
     }
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionItemHistoryController.java

@@ -60,6 +60,8 @@ public class WfTextbookSubscriptionItemHistoryController {
                 .leftJoin(XjrUser.class, XjrUser::getId, WfTextbookSubscriptionItemHistory::getCreateUserId)
                 .eq(dto.getWfTextbookSubscriptionItemId() != null && dto.getWfTextbookSubscriptionItemId() > 0, WfTextbookSubscriptionItemHistory::getWfTextbookSubscriptionItemId, dto.getWfTextbookSubscriptionItemId())
                 .eq(dto.getWfTextbookSubscriptionId() != null && dto.getWfTextbookSubscriptionId() > 0, WfTextbookSubscriptionItemHistory::getWfTextbookSubscriptionId, dto.getWfTextbookSubscriptionId())
+                .like(dto.getBookName() != null && !dto.getBookName().isEmpty(), Textbook::getBookName, dto.getBookName())
+                .like(dto.getCourseSubjectIdCn() != null && !dto.getCourseSubjectIdCn().isEmpty(), BaseCourseSubject::getName, dto.getCourseSubjectIdCn())
                 .orderByAsc("t.wf_textbook_subscription_item_id, t.history_version")
                 ;
         IPage<WfTextbookSubscriptionItemHistoryPageVo> page = wfTextbookSubscriptionItemHistoryService.selectJoinListPage(ConventPage.getPage(dto), WfTextbookSubscriptionItemHistoryPageVo.class, mpjLambdaWrapper);

+ 5 - 0
src/main/java/com/xjrsoft/module/textbook/dto/TextbookInstockroomDto.java

@@ -22,6 +22,11 @@ public class TextbookInstockroomDto {
      */
     @ApiModelProperty("教材教辅征订项编号")
     private Long id;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty(value = "国际标准刊号",hidden = true)
+    private String issn;
     /**
      * 本次入库数量
      */

+ 26 - 0
src/main/java/com/xjrsoft/module/textbook/dto/TextbookInstockroomImportDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.textbook.dto;
+
+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;
+
+@Data
+public class TextbookInstockroomImportDto {
+    /**
+     * 国际标准刊号
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书号(ISSN)")
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 本次入库数量
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("本次入库数量")
+    @ApiModelProperty("本次入库数量")
+    private Integer inNum;
+}

+ 46 - 0
src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionDto.java

@@ -0,0 +1,46 @@
+package com.xjrsoft.module.textbook.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.xjrsoft.module.textbook.vo.WfTextbookSubscriptionItemVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+* @title: 教材教辅征订表单入参
+* @Author szs
+* @Date: 2024-06-04
+* @Version 1.0
+*/
+@Data
+public class WfTextbookSubscriptionDto {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty("主键编号")
+    private Long wfTextbookSubscriptionItemId;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookType;
+    /**
+     * 书名
+     */
+    @ApiModelProperty("书名")
+    private String bookName;
+    /**
+     * 课程编号(base_course_subject)
+     */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private String courseSubjectIdCn;
+
+}

+ 10 - 0
src/main/java/com/xjrsoft/module/textbook/dto/WfTextbookSubscriptionItemHistoryPageDto.java

@@ -31,4 +31,14 @@ public class WfTextbookSubscriptionItemHistoryPageDto extends PageInput {
      */
     @ApiModelProperty("教材教辅征订编号")
     private Long wfTextbookSubscriptionId;
+    /**
+     * 书名
+     */
+    @ApiModelProperty("书名")
+    private String bookName;
+    /**
+     * 课程编号(base_course_subject)
+     */
+    @ApiModelProperty("课程编号(base_course_subject)")
+    private String courseSubjectIdCn;
 }

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

@@ -133,7 +133,7 @@ public interface ITextbookService extends MPJBaseService<Textbook> {
      * @param dto
      * @return
      */
-    List<TextbookSubscriptionExportQueryVo> listTextbookSubscriptionExportQuery(TextbookSubscriptionExportQueryDto dto);
+    ByteArrayOutputStream listTextbookSubscriptionExportQuery(TextbookSubscriptionExportQueryDto dto);
 
     ByteArrayOutputStream listTextbookClaimExportQuery(TextbookClaimExportQueryDto dto);
 

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

@@ -47,7 +47,7 @@ public interface IWfTextbookSubscriptionService extends MPJBaseService<WfTextboo
 
     Boolean changeStatus(UpdateWfTextbookSubscriptionDto dto);
 
-    WfTextbookSubscriptionVo getInfo(Long id);
+    WfTextbookSubscriptionVo getInfo(WfTextbookSubscriptionDto dto);
 
     List<TextbookSubscriptionExportQueryListVo> textbookSubscriptionExportQuery(TextbookSubscriptionExportQueryListDto dto);
 
@@ -56,5 +56,5 @@ public interface IWfTextbookSubscriptionService extends MPJBaseService<WfTextboo
     Boolean instockroom(List<TextbookInstockroomDto> dtos);
 
 
-    Boolean excelImport(InputStream inputStream);
+    Boolean excelImport(InputStream inputStream, Long wfTextbookSubscriptionId);
 }

+ 100 - 52
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java

@@ -7,6 +7,7 @@ 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;
 import com.alibaba.excel.write.metadata.style.WriteCellStyle;
@@ -28,53 +29,19 @@ import com.xjrsoft.common.utils.excel.ExcelFillCellMergePrevColUtil;
 import com.xjrsoft.common.utils.excel.ExcelMergeUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
-import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.base.mapper.BaseCourseSubjectMapper;
-import com.xjrsoft.module.base.mapper.BaseGradeMapper;
 import com.xjrsoft.module.base.mapper.BaseSemesterMapper;
 import com.xjrsoft.module.base.service.IBaseClassService;
-import com.xjrsoft.module.base.vo.BaseClassCoursePageVo;
 import com.xjrsoft.module.teacher.entity.XjrUser;
-import com.xjrsoft.module.textbook.dto.AddTextbookWarehouseRecordDto;
-import com.xjrsoft.module.textbook.dto.TextbookClaimExportQueryDto;
-import com.xjrsoft.module.textbook.dto.TextbookImportDto;
-import com.xjrsoft.module.textbook.dto.TextbookPageDto;
-import com.xjrsoft.module.textbook.dto.TextbookStandingExportQuerytDto;
-import com.xjrsoft.module.textbook.dto.TextbookSubscriptionExportQueryDto;
-import com.xjrsoft.module.textbook.entity.SubjectGroup;
-import com.xjrsoft.module.textbook.entity.Textbook;
-import com.xjrsoft.module.textbook.entity.TextbookClassRelation;
-import com.xjrsoft.module.textbook.entity.TextbookCoreAttribute;
-import com.xjrsoft.module.textbook.entity.TextbookIssueRecord;
-import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
-import com.xjrsoft.module.textbook.entity.TextbookSubscriptionRecord;
-import com.xjrsoft.module.textbook.entity.TextbookWarehouseRecord;
-import com.xjrsoft.module.textbook.entity.WfExerciseBook;
-import com.xjrsoft.module.textbook.entity.WfExerciseBookItem;
-import com.xjrsoft.module.textbook.entity.WfTextbookClaim;
-import com.xjrsoft.module.textbook.mapper.SubjectGroupMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookClassRelationMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookCoreAttributeMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookIssueRecordMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookStudentClaimMapper;
-import com.xjrsoft.module.textbook.mapper.TextbookSubscriptionRecordMapper;
+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.TextbookClaimExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookClassRelationVo;
-import com.xjrsoft.module.textbook.vo.TextbookIssueRecordListVo;
-import com.xjrsoft.module.textbook.vo.TextbookPageVo;
-import com.xjrsoft.module.textbook.vo.TextbookStandingExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionClassVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionRecordVo;
-import com.xjrsoft.module.textbook.vo.TextbookVo;
-import com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordListVo;
-import com.xjrsoft.module.textbook.vo.WfTextbookClaimListVo;
+import com.xjrsoft.module.textbook.vo.*;
 import lombok.AllArgsConstructor;
 import org.apache.poi.ss.usermodel.BorderStyle;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
@@ -86,15 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -124,12 +83,10 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
     private final SubjectGroupMapper subjectGroupMapper;
 
-    private final BaseGradeMapper baseGradeMapper;
+    private final BaseSemesterMapper baseSemesterMapper;
 
     private final BaseCourseSubjectMapper baseCourseSubjectMapper;
 
-    private final BaseSemesterMapper baseSemesterMapper;
-
     private final ITextbookCoreAttributeService textbookCoreAttributeService;
 
     private final TextbookCoreAttributeMapper textbookCoreAttributeMapper;
@@ -615,7 +572,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
     }
 
     @Override
-    public List<TextbookSubscriptionExportQueryVo> listTextbookSubscriptionExportQuery(TextbookSubscriptionExportQueryDto dto) {
+    public ByteArrayOutputStream listTextbookSubscriptionExportQuery(TextbookSubscriptionExportQueryDto dto) {
         List<TextbookSubscriptionExportQueryVo> result = textbookTextbookMapper.listTextbookSubscriptionExportQuery(dto);
         //将班级转换为中文
         for (TextbookSubscriptionExportQueryVo to : result) {
@@ -641,7 +598,97 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                 }
             }
         }
-        return result;
+
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+
+        // 设置动态头
+        String baseSemesterCn = "";
+        if(dto.getBaseSemesterId() != null){
+            LambdaQueryWrapper<BaseSemester> baseSemesterLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            baseSemesterLambdaQueryWrapper
+                    .eq(BaseSemester::getId, dto.getBaseSemesterId());
+            BaseSemester baseSemester = baseSemesterMapper.selectOne(baseSemesterLambdaQueryWrapper);
+            if(baseSemester != null){
+                baseSemesterCn = baseSemester.getName();
+            }
+        }
+        String headTitle = "重庆市铜梁职业教育中心" + baseSemesterCn + "教材征订表";
+        List<List<String>> headList = new ArrayList<>();
+//        List<String> head0 = new ArrayList<>();
+//        head0.add("个人信息");
+//        head0.add("用户名");
+//        List<String> head1 = new ArrayList<>();
+//        head1.add("个人信息");
+//        head1.add("年龄");
+//        List<String> head2 = new ArrayList<>();
+//        head2.add("个人信息");
+//        head2.add("地址");
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("国际标准刊号");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("书名");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("出版社");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("主编");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("估价(元)");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("是否为规划教材");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("对应课程");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("使用年级");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("使用班级");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("学生用书征订数量");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("教师教材用书征订数量");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("教师教参用书征订数量");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("学科组名称");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("有无配套教学资源");
+        }});
+        headList.add(new ArrayList<String>(){{
+            add(headTitle);
+            add("备注");
+        }});
+
+
+
+        EasyExcel.write(bot, TextbookSubscriptionExportQueryVo.class).automaticMergeHead(true).excelType(ExcelTypeEnum.XLSX).head(headList).sheet().doWrite(result);
+
+        return bot;
     }
 
     @Override
@@ -703,6 +750,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         // 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
         HorizontalCellStyleStrategy horizontalCellStyleStrategy =
                 new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
+
         try (ExcelWriter excelWriter = EasyExcel.write(bot, TextbookClaimExportQueryVo.class).registerWriteHandler(horizontalCellStyleStrategy).build()) {
             //已经写入的行
             int rowIndex = 0;

+ 56 - 87
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookSubscriptionServiceImpl.java

@@ -15,6 +15,8 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
+import com.xjrsoft.module.student.entity.BaseClassMajorSet;
+import com.xjrsoft.module.student.vo.BaseClassMajorSetPageVo;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.textbook.dto.*;
 import com.xjrsoft.module.textbook.entity.*;
@@ -192,8 +194,8 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
     }
 
     @Override
-    public WfTextbookSubscriptionVo getInfo(Long id) {
-        WfTextbookSubscription wfTextbookSubscription = this.getById(id);
+    public WfTextbookSubscriptionVo getInfo(WfTextbookSubscriptionDto dto) {
+        WfTextbookSubscription wfTextbookSubscription = this.getById(dto.getId());
         if (wfTextbookSubscription == null) {
             return null;
         }
@@ -210,6 +212,10 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
                         ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemVo::getTextbookTypeCn))
                 .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId)
                 .eq(WfTextbookSubscriptionItem::getWfTextbookSubscriptionId, wfTextbookSubscription.getId())
+                .eq(dto.getWfTextbookSubscriptionItemId() != null && dto.getWfTextbookSubscriptionItemId() > 0, WfTextbookSubscriptionItem::getId, dto.getWfTextbookSubscriptionItemId())
+                .eq(dto.getTextbookType() != null && !dto.getTextbookType().isEmpty(), Textbook::getTextbookType, dto.getTextbookType())
+                .like(dto.getBookName() != null && !dto.getBookName().isEmpty(), Textbook::getBookName, dto.getBookName())
+                .like(dto.getCourseSubjectIdCn() != null && !dto.getCourseSubjectIdCn().isEmpty(), BaseCourseSubject::getName, dto.getCourseSubjectIdCn())
         ;
         List<WfTextbookSubscriptionItemVo> itemList = wfTextbookSubscriptionWfTextbookSubscriptionItemMapper.selectJoinList(WfTextbookSubscriptionItemVo.class, mpjLambdaWrapper);
 
@@ -339,10 +345,38 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         if (dtos.isEmpty()) {
             return false;
         }
+        return saveData(dtos);
+    }
+
+    @Override
+    public Boolean excelImport(InputStream inputStream, Long wfTextbookSubscriptionId) {
+        EasyExcel.read(inputStream, TextbookInstockroomImportDto.class, new PageReadListener<TextbookInstockroomImportDto>(dataList -> {
+            if (dataList.isEmpty()) {
+                throw new MyException("导入数据为空");
+            }
+
+            List<TextbookInstockroomDto> textbookInstockroomDtoList = new ArrayList<>();
+            for (TextbookInstockroomImportDto item : dataList){
+                textbookInstockroomDtoList.add(new TextbookInstockroomDto(){{
+                    setWfTextbookSubscriptionId(wfTextbookSubscriptionId);
+                    setIssn(item.getIssn());
+                    setInNum(item.getInNum());
+                }});
+            }
+            saveData(textbookInstockroomDtoList);
+        })).sheet().doRead();
 
+        return true;
+    }
+
+    private boolean saveData(List<TextbookInstockroomDto> dtos) {
         //获取需要修改的list
-        LambdaQueryWrapper<WfTextbookSubscriptionItem> queryWrapper = new LambdaQueryWrapper<>();
+        MPJLambdaWrapper<WfTextbookSubscriptionItem> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper
+                .select(WfTextbookSubscriptionItem::getId)
+                .selectAs(Textbook::getIssn, WfTextbookSubscriptionItem::getIssn)
+                .select(WfTextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItem.class).contains(x.getProperty()))
+                .leftJoin(Textbook.class, Textbook::getId, WfTextbookSubscriptionItem::getTextbookId)
                 .eq(WfTextbookSubscriptionItem::getWfTextbookSubscriptionId, dtos.get(0).getWfTextbookSubscriptionId())
                 .eq(WfTextbookSubscriptionItem::getDeleteMark, DeleteMark.NODELETE.getCode())
         ;
@@ -352,17 +386,34 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
             return false;
         }
 
-        Map<Long, WfTextbookSubscriptionItem> itemMap = wfTextbookSubscriptionItemList
+        Map<Long, WfTextbookSubscriptionItem> itemByIdMap = wfTextbookSubscriptionItemList
                 .stream()
                 .collect(Collectors.toMap(
                         WfTextbookSubscriptionItem::getId,
                         item -> item
                 ));
 
+        Map<String, WfTextbookSubscriptionItem> itemByIssnMap = wfTextbookSubscriptionItemList
+                .stream()
+                .collect(Collectors.toMap(
+                        WfTextbookSubscriptionItem::getIssn,
+                        item -> item
+                ));
+
         Date now = new Date();
         Long loginId = StpUtil.getLoginIdAsLong();
         for (TextbookInstockroomDto dto : dtos) {
-            WfTextbookSubscriptionItem old = itemMap.get(dto.getId());
+            WfTextbookSubscriptionItem old;
+            if(dto.getId() != null && dto.getId() > 0){
+                old = itemByIdMap.get(dto.getId());
+            } else {
+                old = itemByIssnMap.get(dto.getIssn());
+            }
+
+            if(old == null){
+                continue;
+            }
+
             WfTextbookSubscriptionItem updateItem = new WfTextbookSubscriptionItem();
             updateItem.setId(old.getId());
             updateItem.setInStockroomNum(old.getInStockroomNum() + dto.getInNum());
@@ -379,86 +430,4 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         }
         return true;
     }
-
-    @Override
-    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;
-    }
-
-    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 textbookTypeCn = textbookImportDto.getTextbookTypeCn();
-            String textbookTypeCode = Optional.ofNullable(textbookTypeCn)
-                    .map(TextbookTypeEnum::getCode)
-                    .orElse(null);
-            textbook.setTextbookType(textbookTypeCode);
-
-            // 判断导入的教材是否已经存在,根据教材的 ISBN 码和使用的学期判断
-            LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            textbookLambdaQueryWrapper
-                    .eq(Textbook::getIssn, textbook.getIssn())
-            ;
-
-            Textbook oldTextbook = this.getOne(textbookLambdaQueryWrapper);
-
-            // 已经存在,更新数据
-            if (oldTextbook != null) {
-                // 更新教材数据
-                textbook.setId(oldTextbook.getId());
-                textbookTextbookMapper.updateById(textbook);
-            } else {
-                textbookCoreAttributeService.save(textbookCoreAttribute);
-
-                textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
-                // 插入教材数据
-                textbookTextbookMapper.insert(textbook);
-            }
-        }*/
-    }
 }

+ 21 - 5
src/main/java/com/xjrsoft/module/textbook/vo/TextbookClaimExportQueryVo.java

@@ -80,12 +80,12 @@ public class TextbookClaimExportQueryVo {
     @ApiModelProperty("国际标准刊号")
     private String issn;
     /**
-     * 价(元)
+     * 价(元)
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("价(元)")
-    @ApiModelProperty("价(元)")
-    private BigDecimal appraisalPrice;
+    @ExcelProperty("价(元)")
+    @ApiModelProperty("价(元)")
+    private BigDecimal price;
     /**
      * 小计(元)
      */
@@ -100,10 +100,26 @@ public class TextbookClaimExportQueryVo {
     private Integer num;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("发放情况")
+    @ExcelProperty("发放数量")
     @ApiModelProperty("发放情况")
     private Integer claimNum;
 
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("增领数量")
+    @ApiModelProperty("增领数量")
+    private Integer addClaimNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("退书数量")
+    @ApiModelProperty("退书数量")
+    private Integer recedeNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("实发数量")
+    @ApiModelProperty("实发数量")
+    private Integer studentClaimNum;
+
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("备注")
     @ApiModelProperty("备注")

+ 40 - 4
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionExportQueryListVo.java

@@ -19,16 +19,23 @@ public class TextbookSubscriptionExportQueryListVo {
      * 课程
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("课程")
+    @ExcelProperty("课程名称")
     @ApiModelProperty("课程")
     private String courseName;
     /**
      * 书名
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("书名")
+    @ExcelProperty("教材书名")
     @ApiModelProperty("书名")
     private String bookName;
+    /**
+     * 国际标准刊号
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书号(ISSN)")
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
     /**
      * 出版社
      */
@@ -36,13 +43,21 @@ public class TextbookSubscriptionExportQueryListVo {
     @ExcelProperty("出版社")
     @ApiModelProperty("出版社")
     private String publishingHouse;
+    /**
+     * 主编
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("作者(主编)")
+    @ApiModelProperty("主编")
+    private String editorInChief;
     /**
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("教材类型")
+    @ExcelProperty("类型")
     @ApiModelProperty("教材类型")
     private String textbookTypeCn;
+
     /**
      * 学生用书征订数量
      */
@@ -68,7 +83,28 @@ public class TextbookSubscriptionExportQueryListVo {
      * 使用班级数
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("使用班级数")
+    @ExcelProperty("使用班级数")
     @ApiModelProperty("使用班级数")
     private Integer classNum;
+    /**
+     * 教师教材征订数量
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("征订总数量")
+    @ApiModelProperty("征订总数量")
+    private Integer subscriptionSum;
+    /**
+     * 已入库数量
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("已入库数量")
+    @ApiModelProperty("已入库数量")
+    private Integer inStockroomNum;
+    /**
+     * 本次入库数量
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("本次入库数量")
+    @ApiModelProperty("本次入库数量")
+    private Integer inNum;
 }

+ 36 - 27
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionExportQueryVo.java

@@ -16,21 +16,34 @@ import java.math.BigDecimal;
 */
 @Data
 public class TextbookSubscriptionExportQueryVo {
-
+    /**
+     * 课程
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("对应课程")
+    @ApiModelProperty("对应课程")
+    private String courseName;
+    /**
+     * 书名
+     */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材书名")
+    @ApiModelProperty("书名")
+    private String bookName;
     /**
     * 国际标准刊号
     */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("国际标准刊号")
+    @ExcelProperty("书号(ISSN)")
     @ApiModelProperty("国际标准刊号")
     private String issn;
     /**
-    * 书名
-    */
+     * 主编
+     */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("书名")
-    @ApiModelProperty("书名")
-    private String bookName;
+    @ExcelProperty("作者(主编)")
+    @ApiModelProperty("主编")
+    private String editorInChief;
     /**
     * 出版社
     */
@@ -39,12 +52,22 @@ public class TextbookSubscriptionExportQueryVo {
     @ApiModelProperty("出版社")
     private String publishingHouse;
     /**
-    * 主编
-    */
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("主编")
-    @ApiModelProperty("主编")
-    private String editorInChief;
+    @ExcelProperty("教材类型")
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookTypeCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生用书征订数量")
+    @ApiModelProperty("学生用书征订数量")
+    private Integer studentSubscriptionNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教师教材用书征订数量")
+    @ApiModelProperty("教师教材用书征订数量")
+    private Integer teacherSubscriptionNumber;
     /**
      * 估价(元)
      */
@@ -59,13 +82,7 @@ public class TextbookSubscriptionExportQueryVo {
     @ExcelProperty("是否为规划教材")
     @ApiModelProperty("是否为规划教材")
     private String isTextbookPlanCn;
-    /**
-     * 课程
-     */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("对应课程")
-    @ApiModelProperty("对应课程")
-    private String courseName;
+
     /**
      * 使用年级
      */
@@ -89,15 +106,7 @@ public class TextbookSubscriptionExportQueryVo {
     @ApiModelProperty("使用班级")
     private String useClass;
 
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学生用书征订数量")
-    @ApiModelProperty("学生用书征订数量")
-    private Integer studentSubscriptionNumber;
 
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("教师教材用书征订数量")
-    @ApiModelProperty("教师教材用书征订数量")
-    private Integer teacherSubscriptionNumber;
 
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("教师教参用书征订数量")

+ 1 - 1
src/main/resources/application.yml

@@ -3,7 +3,7 @@ server:
 
 
 spring:
-  # 环境 dev|pre|prod
+  # 环 io境 dev|pre|prod
   profiles:
     active: dev
   # jackson时间格式化

+ 23 - 8
src/main/resources/mapper/textbook/TextbookMapper.xml

@@ -255,9 +255,8 @@
     <select id="listTextbookClaimExportQuery"
             parameterType="com.xjrsoft.module.textbook.dto.TextbookClaimExportQueryDto"
             resultType="com.xjrsoft.module.textbook.vo.TextbookClaimExportQueryVo">
-        with textbook_class as (
-        select
-        t.base_semester_id,
+        with textbook_class as
+        (select t.base_semester_id,
         t.class_id,
         t1.textbook_id,
         sum(t2.stock) as num,
@@ -278,9 +277,21 @@
             and t1.textbook_id = #{dto.textbookId}
         </if>
         group by t.base_semester_id, t.class_id, t1.textbook_id
-        )
-        select
-        t.base_semester_id,
+        ),
+        textbook_recode as
+        (select t.base_semester_id,
+        t.class_id,
+        t1.textbook_id,
+        sum(t1.number) as recedeNum
+        from wf_textbook_recede t
+        inner join wf_textbook_recede_item t1 on t1.wf_textbook_recede_id = t.id
+        left join textbook_class t2
+        on t2.base_semester_id = t.base_semester_id and t2.class_id = t.class_id and
+        t2.textbook_id = t1.textbook_id
+        where t.recede_type = 'recede_deans_office'
+        AND t.status = 1
+        group by t.base_semester_id, t.class_id, t1.textbook_id)
+        select t.base_semester_id,
         t3.name as baseSemesterIdCn,
         t.class_id,
         t4.name as classIdCn,
@@ -292,10 +303,12 @@
         t1.editor_in_chief,
         t1.publishing_house,
         t1.issn,
-        t1.appraisal_price,
+        t1.price,
         t1.subtotal,
         t.num,
-        t.claimNum
+        t.claimNum,
+        ifnull(t7.recedeNum, 0) as recedeNum,
+        (t.claimNum - ifnull(t7.recedeNum, 0)) as studentClaimNum
         from textbook_class t
         left join textbook t1 on t1.id = t.textbook_id
         left join xjr_dictionary_detail t2 on t2.code = t1.textbook_type
@@ -303,6 +316,8 @@
         left join base_class t4 on t4.id = t.class_id
         left join xjr_user t5 on t5.id = t4.teacher_id
         left join base_classroom t6 on t6.id = t4.classroom_id
+        left join textbook_recode t7 on t7.base_semester_id = t.base_semester_id and t7.class_id = t.class_id and
+        t7.textbook_id = t.textbook_id
         where t1.delete_mark = 0
         <if test="dto.textbookType != null and dto.textbookType != ''">
             and t1.textbook_type = #{dto.textbookType}