Explorar o código

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

dzx hai 9 meses
pai
achega
493ff326e5
Modificáronse 18 ficheiros con 763 adicións e 252 borrados
  1. 31 19
      .drone.yml
  2. 1 1
      docker-compose-dev.yml
  3. 3 0
      docker-compose-pre.yml
  4. 3 2
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java
  5. 3 2
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookIssueRecordController.java
  6. 1 1
      src/main/java/com/xjrsoft/module/textbook/controller/TextbookWarehouseRecordController.java
  7. 2 1
      src/main/java/com/xjrsoft/module/textbook/service/ITextbookIssueRecordService.java
  8. 400 49
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookIssueRecordServiceImpl.java
  9. 1 1
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookServiceImpl.java
  10. 22 24
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookSubscriptionServiceImpl.java
  11. 10 8
      src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookWarehouseRecordServiceImpl.java
  12. 3 3
      src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookRecedeServiceImpl.java
  13. 135 134
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookClaimRecordExportVo.java
  14. 2 1
      src/main/java/com/xjrsoft/module/textbook/vo/TextbookWarehouseRecordPageVo.java
  15. 103 5
      src/main/java/com/xjrsoft/module/veb/util/ImportExcelUtil.java
  16. 18 0
      src/main/resources/sqlScript/textbook_sql.sql
  17. 24 0
      src/test/java/com/xjrsoft/module/textbook/service/impl/TextbookIssueRecordServiceImplTest.java
  18. 1 1
      src/test/java/com/xjrsoft/module/textbook/service/impl/WfTextbookRecedeServiceImplTest.java

+ 31 - 19
.drone.yml

@@ -6,15 +6,6 @@ node:
   mode: local_test
 
 steps:
-  # 只需要下载一次,以后将其注释
-#  - name: skywalking
-#    image: alpine/git:v2.45.2
-#    commands:
-#      - git clone https://git.yingcaibx.com/public/skywalking-agent-java.git /root/skywalking-agent-java
-#    volumes:
-#      - name: skywalking-cache
-#        path: /root/skywalking-agent-java
-
   - name: maven
     image: maven:3.6.3-jdk-11
     volumes:
@@ -23,14 +14,23 @@ steps:
     commands:
       - mvn -Dmaven.test.skip=true -P dev clean package
 
+  - name: skywalking
+    image: alpine/git:v2.45.2
+    depends_on: [maven]
+    commands:
+      - git clone https://git.yingcaibx.com/public/skywalking-agent-java.git /drone/src/skywalking-agent-java
+#    volumes:
+#      - name: skywalking-cache
+#        path: /root/skywalking-agent-java
+
   - name: build
     image: docker:20.10.7
-    depends_on: [maven]
+    depends_on: [skywalking]
     volumes:
       - name: docker
         path: /var/run/docker.sock
-      - name: skywalking-cache
-        path: /drone/src/skywalking-agent-java
+#      - name: skywalking-cache
+#        path: /drone/src/skywalking-agent-java
     environment:
       IMAGE: registry.yingcaibx.com/tl/api:latest
     commands:
@@ -60,9 +60,9 @@ volumes:
   - name: maven-cache
     host:
       path: /data/cache/tl/api
-  - name: skywalking-cache
-    host:
-      path: /data/cache/skywalking
+#  - name: skywalking-cache
+#    host:
+#      path: /data/cache/skywalking
 
 ---
 kind: pipeline
@@ -81,9 +81,15 @@ steps:
     commands:
       - mvn -Dmaven.test.skip=true -P dev clean package
 
+  - name: skywalking
+    image: alpine/git:v2.45.2
+    depends_on: [maven]
+    commands:
+      - git clone https://git.yingcaibx.com/public/skywalking-agent-java.git /drone/src/skywalking-agent-java
+
   - name: build
     image: docker:20.10.7
-    depends_on: [maven]
+    depends_on: [skywalking]
     volumes:
       - name: docker
         path: /var/run/docker.sock
@@ -134,16 +140,22 @@ steps:
     commands:
       - mvn -Dmaven.test.skip=true -P dev clean package
 
+  - name: skywalking
+    image: alpine/git:v2.45.2
+    depends_on: [maven]
+    commands:
+      - git clone https://git.yingcaibx.com/public/skywalking-agent-java.git /drone/src/skywalking-agent-java
+
   - name: push
     image: docker:20.10.7
     volumes:
       - name: docker
         path: /var/run/docker.sock
     environment:
-      IMAGE: registry.yingcaibx.com/tl/api
-    depends_on: [maven]
+      IMAGE: crpi-j16ma2m5r6mxrmhw.cn-shenzhen.personal.cr.aliyuncs.com/ruiyaninfo/cqtlzjzx-api
+    depends_on: [skywalking]
     commands:
-      - docker login -u yxt -p qwe123QWE registry.yingcaibx.com
+      - docker login -u 瑞研科技 -p ry123*456 crpi-j16ma2m5r6mxrmhw.cn-shenzhen.personal.cr.aliyuncs.com
       - echo $DRONE_TAG
       - docker build -f ./Dockerfile -t $IMAGE:$DRONE_TAG ./
       - docker push $IMAGE:$DRONE_TAG

+ 1 - 1
docker-compose-dev.yml

@@ -12,7 +12,7 @@ services:
       - SPRING_PROFILES_ACTIVE=dev
       - SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL=jdbc:mysql://mysql:3306/tl?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&autoReconnect=true&failOverReadOnly=false
       - SW_AGENT_COLLECTOR_BACKEND_SERVICES=10.150.10.135:11800
-      - SW_AGENT_NAME=tl-admin
+      - SW_AGENT_NAME=tl-admin-dev
       - JAVA_AGENT=/skywalking-agent-java/skywalking-agent.jar
     ports:
       - 8001:8080

+ 3 - 0
docker-compose-pre.yml

@@ -11,6 +11,9 @@ services:
     environment:
       - SPRING_PROFILES_ACTIVE=pre
       - SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL=jdbc:mysql://mysql:3306/tl?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&autoReconnect=true&failOverReadOnly=false
+      - SW_AGENT_COLLECTOR_BACKEND_SERVICES=10.150.10.135:11800
+      - SW_AGENT_NAME=tl-admin-pre
+      - JAVA_AGENT=/skywalking-agent-java/skywalking-agent.jar
     ports:
       - 8080:8080
     networks:

+ 3 - 2
src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java

@@ -27,6 +27,7 @@ import com.xjrsoft.module.veb.util.ImportExcelUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.apache.poi.ss.usermodel.IndexedColors;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -269,11 +270,11 @@ public class TextbookController {
 
         // 标题
         String title = "教材信息导入模板";
-        ImportExcelUtil.createCautionHead(workbook, sheet, 0, title, importConfigs.size() - 1, 36);
+        ImportExcelUtil.createCautionHead(workbook, sheet, 0, title, importConfigs.size() - 1, 36, IndexedColors.RED.getIndex());
 
         // 提示必填
         String content = "说明:红底为必填项,白底为非必填项;只有教材分类为教材时才需要填写学科组和对应课程,学科组和课程必须是系统中已添加的信息,且学科组和课程已建立绑定关系;导入时请将示例数据删除,避免导入失败!";
-        ImportExcelUtil.createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12);
+        ImportExcelUtil.createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12, IndexedColors.RED.getIndex());
 
         // 表头
         ImportExcelUtil.createHead(workbook, sheet, importConfigs, 2);

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

@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
@@ -136,10 +137,10 @@ public class TextbookIssueRecordController {
 
     @PostMapping("/claim-record-export-query")
     @ApiOperation(value = "教材发放记录条件导出")
-    public ResponseEntity<byte[]> claimRecordExportDataQuery(@Valid @RequestBody TextbookClaimRecordExportDto dto) {
+    public ResponseEntity<byte[]> claimRecordExportDataQuery(@Valid @RequestBody TextbookClaimRecordExportDto dto) throws IOException {
 //    @GetMapping("/claim-record-export-query")
 //    @ApiOperation(value = "教材发放记录条件导出")
-//    public ResponseEntity<byte[]> claimRecordExportDataQuery(@Valid TextbookClaimRecordExportDto dto) {
+//    public ResponseEntity<byte[]> claimRecordExportDataQuery(@Valid TextbookClaimRecordExportDto dto) throws IOException {
         ByteArrayOutputStream bot = textbookIssueRecordService.claimRecordExportDataQuery(dto);
 
         String fileName = "教材发放记录";

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

@@ -68,7 +68,7 @@ public class TextbookWarehouseRecordController {
         return RT.ok(BeanUtil.toBean(textbookWarehouseRecord, TextbookWarehouseRecordVo.class));
     }
 
-    @PostMapping("textbook-warehouse")
+    @PostMapping("/textbook-warehouse")
     @ApiOperation(value = "教材入库页面教材入库")
     @SaCheckPermission("textbookclasswarehouse:add")
     public RT<Boolean> textbookWarehouse(@Valid @RequestBody AddTextbookWarehouseRecordDto dto){

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

@@ -11,6 +11,7 @@ import com.xjrsoft.module.textbook.vo.TextbookIssueRecordExcelVo;
 import com.xjrsoft.module.textbook.vo.TextbookIssueRecordPageVo;
 
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -34,5 +35,5 @@ public interface ITextbookIssueRecordService extends MPJBaseService<TextbookIssu
 
     ByteArrayOutputStream exportDataQuery(TextbookIssueRecordExportDto dto);
 
-    ByteArrayOutputStream claimRecordExportDataQuery(TextbookClaimRecordExportDto dto);
+    ByteArrayOutputStream claimRecordExportDataQuery(TextbookClaimRecordExportDto dto) throws IOException;
 }

+ 400 - 49
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookIssueRecordServiceImpl.java

@@ -7,15 +7,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 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.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.ClaimTypeEnum;
 import com.xjrsoft.common.enums.RecedeTypeEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.page.ConventPage;
 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.entity.BaseGrade;
-import com.xjrsoft.module.base.entity.BaseSemester;
+import com.xjrsoft.module.base.entity.*;
+import com.xjrsoft.module.generator.entity.ImportConfig;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.*;
@@ -23,17 +22,22 @@ import com.xjrsoft.module.textbook.entity.*;
 import com.xjrsoft.module.textbook.mapper.TextbookIssueRecordMapper;
 import com.xjrsoft.module.textbook.service.ITextbookIssueRecordService;
 import com.xjrsoft.module.textbook.vo.*;
+import com.xjrsoft.module.veb.util.ImportExcelUtil;
 import io.swagger.models.auth.In;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.codehaus.groovy.runtime.typehandling.IntegerMath;
 import org.springframework.stereotype.Service;
 
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -306,69 +310,416 @@ public class TextbookIssueRecordServiceImpl extends MPJBaseServiceImpl<TextbookI
     }
 
     @Override
-    public ByteArrayOutputStream claimRecordExportDataQuery(TextbookClaimRecordExportDto dto) {
+    public ByteArrayOutputStream claimRecordExportDataQuery(TextbookClaimRecordExportDto dto) throws IOException {
         MPJLambdaWrapper<TextbookIssueRecord> textbookIssueRecordMPJLambdaWrapper = new MPJLambdaWrapper<>();
         textbookIssueRecordMPJLambdaWrapper
                 .disableSubLogicDel()
                 .select(TextbookIssueRecord::getId)
-                .selectAs(TextbookWarehouseRecord::getPrice, TextbookIssueRecordExcelVo::getPrice)
-                .selectAs(TextbookWarehouseRecord::getSubtotal, TextbookIssueRecordExcelVo::getSubtotal)
-                .select(TextbookIssueRecord.class, x -> VoToColumnUtil.fieldsToColumns(TextbookIssueRecordExcelVo.class).contains(x.getProperty()))
-                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookIssueRecordExcelVo.class).contains(x.getProperty()))
+                .selectAs(TextbookWarehouseRecord::getPrice, TextbookClaimRecordExportVo::getPrice)
+                .selectAs(TextbookWarehouseRecord::getSubtotal, TextbookClaimRecordExportVo::getSubtotal)
+                .select(TextbookIssueRecord.class, x -> VoToColumnUtil.fieldsToColumns(TextbookClaimRecordExportVo.class).contains(x.getProperty()))
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookClaimRecordExportVo.class).contains(x.getProperty()))
+                .leftJoin(TextbookWarehouseRecord.class, TextbookWarehouseRecord::getId, TextbookIssueRecord::getTextbookWarehouseRecordId)
                 .leftJoin(BaseSemester.class, BaseSemester::getId, TextbookIssueRecord::getBaseSemesterId,
                         wrapper -> wrapper
-                                .selectAs(BaseSemester::getName, TextbookIssueRecordExcelVo::getBaseSemesterIdCn)
-                )
-                .leftJoin(TextbookWarehouseRecord.class, TextbookWarehouseRecord::getId, TextbookIssueRecord::getTextbookWarehouseRecordId,
-                        wrapper -> wrapper
-                                .selectAs(TextbookWarehouseRecord::getOrderNumber, TextbookIssueRecordExcelVo::getWarehouseOrderNumber)
+                                .selectAs(BaseSemester::getName, TextbookClaimRecordExportVo::getBaseSemesterIdCn)
                 )
-                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, TextbookIssueRecord::getIssueMode,
-                        wrapper -> wrapper
-                                .selectAs(DictionaryDetail::getName, TextbookIssueRecordExcelVo::getIssueModeCn)
-                )
-                .leftJoin(Textbook.class, Textbook::getId, TextbookIssueRecord::getTextbookId,
+                .leftJoin(WfTextbookClaim.class, WfTextbookClaim::getId, TextbookIssueRecord::getDataId,
                         wrapper -> wrapper
-                                .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId,
+                                .select("(select " +
+                                        "    count(id) as totalStuNum " +
+                                        "from base_student_school_roll a " +
+                                        "where a.class_id = t3.class_id " +
+                                        "and delete_mark = 0 " +
+                                        "and archives_status = '" + ArchivesStatusEnum.FB2901.getCode() + "') as totalStuNum ")
+                                .selectAs(WfTextbookClaim::getClassId, TextbookClaimRecordExportVo::getClassId)
+                                .selectAs(WfTextbookClaim::getClaimType, TextbookClaimRecordExportVo::getClaimType)
+                                .leftJoin(BaseClass.class, BaseClass::getId, WfTextbookClaim::getClassId,
                                         wra -> wra
-                                                .selectAs(BaseCourseSubject::getName, TextbookIssueRecordExcelVo::getCourseName)
+                                                .selectAs(BaseClass::getName, TextbookClaimRecordExportVo::getClassIdCn)
                                 )
-                                .leftJoin(SubjectGroup.class, SubjectGroup::getId, Textbook::getSubjectGroupId,
+                                .leftJoin(XjrUser.class, XjrUser::getId, BaseClass::getTeacherId,
                                         wra -> wra
-                                                .selectAs(SubjectGroup::getGroupName, TextbookIssueRecordExcelVo::getGroupName)
+                                                .selectAs(XjrUser::getName, TextbookClaimRecordExportVo::getTeacherIdCn)
+                                                .selectAs(XjrUser::getMobile, TextbookClaimRecordExportVo::getTeacherMobile)
                                 )
-                                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                                .leftJoin(BaseClassroom.class, BaseClassroom::getId, BaseClass::getClassroomId,
                                         wra -> wra
-                                                .selectAs(DictionaryDetail::getName, TextbookIssueRecordExcelVo::getTextbookTypeCn)
+                                                .selectAs(BaseClassroom::getName, TextbookClaimRecordExportVo::getClassroomIdCn)
                                 )
                 )
-                .leftJoin(XjrUser.class, XjrUser::getId, TextbookIssueRecord::getReceiveUserId,
-                        wrapper -> wrapper
-                                .selectAs(XjrUser::getName, TextbookIssueRecordExcelVo::getClaimUser)
-                )
-                .leftJoin(WfTextbookClaim.class, WfTextbookClaim::getId, TextbookIssueRecord::getDataId,
+                .leftJoin(Textbook.class, Textbook::getId, TextbookIssueRecord::getTextbookId,
                         wrapper -> wrapper
-                                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfTextbookClaim::getClaimType,
-                                        wra -> wra
-                                                .selectAs(DictionaryDetail::getName, TextbookIssueRecordExcelVo::getClaimTypeCn)
-                                )
-                                .leftJoin(BaseClass.class, BaseClass::getId, WfTextbookClaim::getClassId,
-                                        wra -> wra
-                                                .selectAs(BaseClass::getName, TextbookIssueRecordExcelVo::getClassIdCn)
-                                )
-                                .leftJoin(BaseGrade.class, BaseGrade::getId, BaseClass::getGradeId,
+                                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
                                         wra -> wra
-                                                .selectAs(BaseGrade::getName, TextbookIssueRecordExcelVo::getGradeIdCn)
+                                                .selectAs(DictionaryDetail::getName, TextbookClaimRecordExportVo::getTextbookTypeCn)
                                 )
                 )
-                .leftJoin(XjrUser.class, XjrUser::getId, TextbookIssueRecord::getIssueUserId,
-                        wrapper -> wrapper
-                                .selectAs(XjrUser::getName, TextbookIssueRecordExcelVo::getIssueUserIdCn)
-                )
+                .isNotNull(WfTextbookClaim::getClassId)
         ;
+        List<TextbookClaimRecordExportVo> dataList = textbookIssueRecordMapper.selectJoinList(TextbookClaimRecordExportVo.class, textbookIssueRecordMPJLambdaWrapper);
 
-        List<TextbookIssueRecordExcelVo> dataList = textbookIssueRecordMapper.selectJoinList(TextbookIssueRecordExcelVo.class, textbookIssueRecordMPJLambdaWrapper);
+        // 处理数据
+        // 将数据根据学期和班级进行拆分
+        Map<String, List<TextbookClaimRecordExportVo>> groupBySemesterAndClassMap = dataList.stream()
+                .filter(t -> ObjectUtils.isNotEmpty(t.getClassId()))
+                .collect(Collectors.groupingBy(t -> t.baseSemesterId + "-" + t.getClassId()));
+
+        // 开始写入
+        Workbook workbook = new XSSFWorkbook();
+        // 创建一个工作表(sheet)
+        String sheetName = "sheet1";
+        Sheet sheet = workbook.createSheet(sheetName);
+
+        // 写大标题
+        int rowNumber = 0;
+        ImportExcelUtil.createBigHead(workbook, sheet, "铜梁执教中心班级教材教辅发放情况表", rowNumber++, 19);
+
+        // 字体内容格式
+        Font font = workbook.createFont();
+        font.setBold(false);// 设置为粗体
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        // 设置边框样式为细线
+        cellStyle.setBorderTop(BorderStyle.THIN);
+        cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        cellStyle.setBorderRight(BorderStyle.THIN);
+        cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
+
+        // 根据学期和班级开始写入
+        List<ImportConfig> importConfigs = ImportExcelUtil.allFields(new TextbookClaimRecordExportVo());
+        List<ImportConfig> eachImportConfigs;
+        List<TextbookClaimRecordExportVo> result;
+        List<List<String>> resultList;
+        Map<Integer, Integer> numMap;
+        String firstCellContent;
+        String oldFirstCellContent;
+        int mergeStartIndex;
+        BigDecimal totalSubtotal = BigDecimal.ZERO;
+        BigDecimal totalPrice;
+        for (Map.Entry<String, List<TextbookClaimRecordExportVo>> entry : groupBySemesterAndClassMap.entrySet()){
+            String key = entry.getKey();
+            List<TextbookClaimRecordExportVo> value = entry.getValue();
+
+            if(ObjectUtils.isEmpty(value)){
+                continue;
+            }
+
+            // 处理数据
+            result = new ArrayList<>();
+            Map<Integer, String> colNameMap = statistics(value, result);
+            // 使用 TreeMap 对 key 进行排序
+            Map<Integer, String> sortedMap = new TreeMap<>(colNameMap);
+            // 处理动态表头
+            eachImportConfigs = new ArrayList<>(importConfigs);
+            for (Map.Entry<Integer, String> colNameEntry : sortedMap.entrySet()){
+                ImportConfig importConfig = new ImportConfig();
+                importConfig.setFieldName("issue" + colNameEntry.getKey());
+                importConfig.setLabel(colNameEntry.getValue());
+                importConfig.setWidth(0);
+                importConfig.setRequired(false);
+                importConfig.setSortCode(eachImportConfigs.size());
+                eachImportConfigs.add(importConfig);
+            }
+            // 处理后续的列名
+            addImportConfig(eachImportConfigs);
+
+            // 班级信息
+            String classInfoHead = "学期:" + value.get(0).getBaseSemesterIdCn() + "  " +
+                    "班级:" + value.get(0).getClassIdCn() + "  " +
+                    "班主任:" + value.get(0).getTeacherIdCn() + "  " +
+                    "班主任电话:" + value.get(0).getTeacherMobile() + "  " +
+                    "教室:" + value.get(0).getClassroomIdCn() + "  " +
+                    "班级人数:" + value.get(0).getTotalStuNum() + "  ";
+            ImportExcelUtil.createCautionHead(workbook, sheet, rowNumber++, classInfoHead, eachImportConfigs.size() - 1, 12, IndexedColors.BLACK.getIndex());
+
+
+            // 表头
+            ImportExcelUtil.createHead(workbook, sheet, eachImportConfigs, rowNumber++);
+
+            // 处理每个单元格的内容
+            resultList = new ArrayList<>();
+            for (TextbookClaimRecordExportVo vo : result) {
+                List<String> data = new ArrayList<>();
+                data.add(vo.getTextbookTypeCn());
+                data.add(vo.getBookName());
+                data.add(vo.getIssn());
+                data.add(vo.getEditorInChief());
+                data.add(vo.getPublishingHouse());
+                data.add(vo.getPrice() + "");
+                data.add(vo.getSubtotal() + "");
+                if(ObjectUtils.isEmpty(vo.getSummation())){
+                    data.add("0");
+                }else {
+                    data.add(vo.getSummation() + "");
+                }
+
+                numMap = vo.getNumMap();
+                if(ObjectUtils.isNotEmpty(numMap)){
+                    for (Map.Entry<Integer, String> colNameEntry : sortedMap.entrySet()){
+                        Integer issueNUm = numMap.get(colNameEntry.getKey());
+                        if(ObjectUtils.isNotEmpty(issueNUm)){
+                            data.add(issueNUm + "");
+                        }else {
+                            data.add(0 + "");
+                        }
+                    }
+                }
+
+                data.add(vo.getIssueNumber() + "");
+                data.add(vo.getRecedeNumber() + "");
+                data.add(vo.getActualIssueNumber() + "");
+                data.add(vo.getActualTotalPrice() + "");
+                data.add(vo.getRemark());
+
+                resultList.add(data);
+            }
+
+            // 写入内容
+            mergeStartIndex = rowNumber;
+            totalPrice = BigDecimal.ZERO;
+            for (int i = 0; i < resultList.size(); i++) {
+                List<String> rowData = resultList.get(i);
+                Row dataRow = sheet.createRow(rowNumber);
+                for (int j = 0; j < rowData.size(); j ++){
+                    String content = rowData.get(j);
+                    Cell cell = dataRow.createCell(j);
+                    cell.setCellValue(content);
+                    cell.setCellStyle(cellStyle);
+                }
+                firstCellContent = rowData.get(0);
+                totalPrice = totalPrice.add(StringUtils.isEmpty(rowData.get(rowData.size() - 2)) ? BigDecimal.ZERO : BigDecimal.valueOf(Double.parseDouble(rowData.get(rowData.size() - 2))));
+                //是否是最后一个元素
+                if((i == resultList.size() - 1)){
+                    if(rowNumber - mergeStartIndex > 0){
+                        // 合并当前教材类型
+                        sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 0, 0));
+                        sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 7, 7));
+                    }
+                    totalSubtotal = totalSubtotal.add(ObjectUtils.isNotEmpty(rowData.get(7)) ? BigDecimal.valueOf(Double.parseDouble(rowData.get(7))) : BigDecimal.ZERO);
+                }else {
+                    List<String> nextRowData = resultList.get(i + 1);
+                    if(ObjectUtils.isEmpty(firstCellContent)
+                            && ObjectUtils.isNotEmpty(nextRowData.get(0))
+                    ){
+                        if(rowNumber - mergeStartIndex > 0){
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 0, 0));
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 7, 7));
+                        }
+                        totalSubtotal = totalSubtotal.add(ObjectUtils.isNotEmpty(rowData.get(7)) ? BigDecimal.valueOf(Double.parseDouble(rowData.get(7))) : BigDecimal.ZERO);
+                        mergeStartIndex = rowNumber + 1;
+                    }
+
+                    if(ObjectUtils.isNotEmpty(firstCellContent)
+                            && ObjectUtils.isEmpty(nextRowData.get(0))
+                    ){
+                        if(rowNumber - mergeStartIndex > 0){
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 0, 0));
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 7, 7));
+                        }
+                        totalSubtotal = totalSubtotal.add(ObjectUtils.isNotEmpty(rowData.get(7)) ? BigDecimal.valueOf(Double.parseDouble(rowData.get(7))) : BigDecimal.ZERO);
+                        mergeStartIndex = rowNumber + 1;
+                    }
+
+                    if(ObjectUtils.isNotEmpty(firstCellContent)
+                            && ObjectUtils.isNotEmpty(nextRowData.get(0))
+                            && !firstCellContent.equals(nextRowData.get(0))
+                    ){
+                        if(rowNumber - mergeStartIndex > 0){
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 0, 0));
+                            sheet.addMergedRegion(new CellRangeAddress(mergeStartIndex, rowNumber, 7, 7));
+                        }
+                        totalSubtotal = totalSubtotal.add(ObjectUtils.isNotEmpty(rowData.get(7)) ? BigDecimal.valueOf(Double.parseDouble(rowData.get(7))) : BigDecimal.ZERO);
+                        mergeStartIndex = rowNumber + 1;
+                    }
+                }
+                rowNumber++;
+            }
+
+            // 写入小计
+            Row totalSubtotalRow = sheet.createRow(rowNumber);
+            Cell totalSubtotalStrCell = totalSubtotalRow.createCell(0);
+            totalSubtotalStrCell.setCellValue("小计");
+            totalSubtotalStrCell.setCellStyle(cellStyle);
+
+            Cell totalSubtotalRowCell = totalSubtotalRow.createCell(7);
+            totalSubtotalRowCell.setCellValue(totalSubtotal.toString());
+            totalSubtotalRowCell.setCellStyle(cellStyle);
+
+            Cell totalPriceRowCell = totalSubtotalRow.createCell(eachImportConfigs.size() - 2);
+            totalPriceRowCell.setCellValue(totalPrice.toString());
+            totalPriceRowCell.setCellStyle(cellStyle);
+
+            sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 6));
+            rowNumber++;
+
+            // 写入签名
+            Row signatureRow = sheet.createRow(rowNumber);
+            Cell stuSignatureRowCell = signatureRow.createCell(eachImportConfigs.size() - 5);
+            stuSignatureRowCell.setCellValue("学生代表");
+            stuSignatureRowCell.setCellStyle(cellStyle);
+
+            Cell teaSignatureRowCell = signatureRow.createCell(eachImportConfigs.size() - 2);
+            teaSignatureRowCell.setCellValue("班主任");
+            teaSignatureRowCell.setCellStyle(cellStyle);
+
+            rowNumber = rowNumber + 3;
+        }
+        // 自动列宽
+        for (int i = 0; i < importConfigs.size(); i++){
+            sheet.autoSizeColumn(i);
+        }
+
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        workbook.write(bot);
+        return bot;
+    }
+
+    private void addImportConfig(List<ImportConfig> eachImportConfigs){
+        ImportConfig importConfig1 = new ImportConfig();
+        importConfig1.setFieldName("issueNumber");
+        importConfig1.setLabel("学生领取数量");
+        importConfig1.setWidth(0);
+        importConfig1.setRequired(false);
+        importConfig1.setSortCode(eachImportConfigs.size());
+        eachImportConfigs.add(importConfig1);
+
+        ImportConfig importConfig2 = new ImportConfig();
+        importConfig2.setFieldName("recedeNumber");
+        importConfig2.setLabel("退书数量");
+        importConfig2.setWidth(0);
+        importConfig2.setRequired(false);
+        importConfig2.setSortCode(eachImportConfigs.size());
+        eachImportConfigs.add(importConfig2);
+
+        ImportConfig importConfig3 = new ImportConfig();
+        importConfig3.setFieldName("actualIssueNumber");
+        importConfig3.setLabel("实发数量");
+        importConfig3.setWidth(0);
+        importConfig3.setRequired(false);
+        importConfig3.setSortCode(eachImportConfigs.size());
+        eachImportConfigs.add(importConfig3);
+
+        ImportConfig importConfig4 = new ImportConfig();
+        importConfig4.setFieldName("actualTotalPrice");
+        importConfig4.setLabel("总价");
+        importConfig4.setWidth(0);
+        importConfig4.setRequired(false);
+        importConfig4.setSortCode(eachImportConfigs.size());
+        eachImportConfigs.add(importConfig4);
+
+        ImportConfig importConfig5 = new ImportConfig();
+        importConfig4.setFieldName("remark");
+        importConfig5.setLabel("备注");
+        importConfig5.setWidth(0);
+        importConfig5.setRequired(false);
+        importConfig5.setSortCode(eachImportConfigs.size());
+        eachImportConfigs.add(importConfig5);
+    }
+
+    private Map<Integer, String> statistics(List<TextbookClaimRecordExportVo> value, List<TextbookClaimRecordExportVo> result){
+        Map<Integer, String> colNameMap = new LinkedHashMap<>();
+        // 进行分组统计
+        // 根据教材类型分组
+        Map<String, List<TextbookClaimRecordExportVo>> groupByTextbookTypeMap = value.stream()
+                .filter(t -> ObjectUtils.isNotEmpty(t.getTextbookType()))
+                .collect(Collectors.groupingBy(TextbookClaimRecordExportVo::getTextbookType));
+
+        BigDecimal summation;
+        Map<Integer, Integer> numMap;
+        int stuClaimNum;
+        int recedeNumber;
+        int actualIssueNumber;
+        // 定义日期格式
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        TextbookClaimRecordExportVo first;
+        List<TextbookClaimRecordExportVo> teypResult;
+        // 遍历教材类型
+        for (Map.Entry<String, List<TextbookClaimRecordExportVo>> en : groupByTextbookTypeMap.entrySet()) {
+            String k = en.getKey();
+            List<TextbookClaimRecordExportVo> v = en.getValue();
+            if(ObjectUtils.isEmpty(v)){
+                continue;
+            }
+
+            summation = BigDecimal.ZERO;
+            teypResult = new ArrayList<>();
+            // 根据教材分组
+            Map<Long, List<TextbookClaimRecordExportVo>> groupByTextbookIdMap = v.stream()
+                    .filter(t -> ObjectUtils.isNotEmpty(t.getTextbookId()))
+                    .collect(Collectors.groupingBy(TextbookClaimRecordExportVo::getTextbookId));
+
+            // 遍历教材分组
+            for (Map.Entry<Long, List<TextbookClaimRecordExportVo>> enen : groupByTextbookIdMap.entrySet()) {
+                Long kk = enen.getKey();
+                List<TextbookClaimRecordExportVo> vv = enen.getValue();
+                if(ObjectUtils.isEmpty(vv)){
+                    continue;
+                }
+                first = vv.get(0);
+                if(ObjectUtils.isEmpty(first)){
+                    continue;
+                }
+                stuClaimNum = 0;
+                recedeNumber = 0;
+                actualIssueNumber = 0;
+                summation = summation.add(first.getSubtotal());
+
+                // 使用 List.sort 进行升序排序
+                vv.sort(Comparator.comparingInt(TextbookClaimRecordExportVo::getIssueTimes));
+
+                numMap = new LinkedHashMap<>();
+
+                for (TextbookClaimRecordExportVo vo : vv){
+                    // 处理合计
+                    if(!colNameMap.containsKey(vo.getIssueTimes())){
+                        colNameMap.put(vo.getIssueTimes(), "第" + vo.getIssueTimes() + "次发放数量(" + sdf.format(vo.getCreateDate()) + ")");
+                    }
+
+                    if(ClaimTypeEnum.ClaimClass.getCode().equals(vo.getClaimType())){
+                        if(numMap.containsKey(vo.getIssueTimes())){
+                            numMap.put(vo.getIssueTimes(), numMap.get(vo.getIssueTimes()) + vo.getIssueNumber());
+                        }else {
+                            numMap.put(vo.getIssueTimes(), vo.getIssueNumber());
+                        }
+                        recedeNumber += vo.getRecedeNumber();
+                        actualIssueNumber += vo.getActualIssueNumber();
+                    }
+
+                    if(ClaimTypeEnum.ClaimStudent.getCode().equals(vo.getClaimType())){
+                        stuClaimNum += vo.getIssueNumber();
+                        recedeNumber += vo.getRecedeNumber();
+                        actualIssueNumber += vo.getActualIssueNumber();
+                    }
+                }
+
+                first.setIssueNumber(stuClaimNum);
+                first.setRecedeNumber(recedeNumber);
+                first.setActualIssueNumber(actualIssueNumber);
+                first.setActualTotalPrice(first.getSubtotal().multiply(BigDecimal.valueOf(actualIssueNumber)));
+                first.setNumMap(numMap);
+                teypResult.add(first);
+            }
+
+            // 赋值小计
+            for (TextbookClaimRecordExportVo vo : teypResult){
+                vo.setSummation(summation);
+            }
+            result.addAll(teypResult);
+        }
 
-        return null;
+        return colNameMap;
     }
 }

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

@@ -222,7 +222,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                 .like(StringUtils.isNotBlank(dto.getEditorInChief()), Textbook::getEditorInChief, dto.getEditorInChief())
                 .eq(StringUtils.isNotBlank(dto.getVersion()), Textbook::getVersion, dto.getVersion())
                 .eq(ObjectUtils.isNotEmpty(dto.getCourseSubjectId()), Textbook::getCourseSubjectId, dto.getCourseSubjectId())
-                .eq(ObjectUtils.isNotEmpty(dto.getSubjectGroupId()), Textbook::getCourseSubjectId, dto.getCourseSubjectId())
+                .eq(ObjectUtils.isNotEmpty(dto.getSubjectGroupId()), Textbook::getCourseSubjectId, dto.getSubjectGroupId())
                 .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())

+ 22 - 24
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookSubscriptionServiceImpl.java

@@ -540,7 +540,7 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
 
             updateItem = new TextbookSubscriptionItem();
             updateItem.setId(old.getId());
-            updateItem.setDiscount(dto.getDiscount());
+            updateItem.setDiscount(ObjectUtils.isNotEmpty(dto.getDiscount()) ? dto.getDiscount() : 10);
             updateItem.setPrice(dto.getPrice().multiply(BigDecimal.valueOf(dto.getDiscount() / 10)));
             updateItem.setInStockNum(old.getInStockNum() + dto.getInNum());
             updateItem.setModifyDate(new Date());
@@ -698,7 +698,7 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
             updateItem = new TextbookSubscriptionItem();
             updateItem.setId(oldItem.getId());
             if(ObjectUtils.isEmpty(oldItem.getInStockNum()) || oldItem.getInStockNum() <= 0){
-                updateItem.setDiscount(vo.getDiscount());
+                updateItem.setDiscount(ObjectUtils.isNotEmpty(vo.getDiscount()) ? vo.getDiscount() : 10);
                 updateItem.setPrice(vo.getPrice().multiply(BigDecimal.valueOf(vo.getDiscount() / 10)));
             }
             updateItem.setInStockNum(oldItem.getInStockNum() + vo.getInNum());
@@ -869,36 +869,37 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
             throw new MyException("征订项已经被修改,刷新重试");
         }
 
-        MPJLambdaWrapper<TextbookSubscription> textbookSubscriptionMPJLambdaWrapper = new MPJLambdaWrapper<>();
-        textbookSubscriptionMPJLambdaWrapper
-                .select(TextbookSubscription.class, x -> VoToColumnUtil.fieldsToColumns(TextbookSubscription.class).contains(x.getProperty()))
-                .eq(TextbookSubscriptionItem::getId, dto.getId())
-                .innerJoin(TextbookSubscriptionItem.class, TextbookSubscriptionItem::getTextbookSubscriptionId, TextbookSubscription::getId)
-        ;
+        TextbookSubscription textbookSubscription = this.getById(old.getTextbookSubscriptionId());
 
-        TextbookSubscription textbookSubscription = this.selectJoinOne(TextbookSubscription.class, textbookSubscriptionMPJLambdaWrapper);
+        if(ObjectUtils.isEmpty(textbookSubscription)){
+            throw new MyException("征订已经被修改,刷新重试");
+        }
 
         // 判断变更状态
         int alterationType = 0;
-        TextbookSubscription updateTotalNum = new TextbookSubscription();
         if(!old.getStudentNum().equals(dto.getStudentNum())
                 || !old.getTeacherNum().equals(dto.getTeacherNum())
         ){
             alterationType = 1;
-            if(ObjectUtils.isNotEmpty(textbookSubscription)){
-                updateTotalNum.setId(textbookSubscription.getId());
-                updateTotalNum.setSum(textbookSubscription.getSum() + (dto.getStudentNum() - old.getStudentNum()) + (dto.getTeacherNum() - old.getTeacherNum()));
-                this.updateById(updateTotalNum);
-            }
         }
 
         if(!old.getTextbookId().equals(dto.getTextbookId())){
             alterationType = 2;
-            if(ObjectUtils.isNotEmpty(textbookSubscription)){
-                updateTotalNum.setId(textbookSubscription.getId());
-                updateTotalNum.setSum(textbookSubscription.getSum() - (old.getTeacherNum() + old.getStudentNum()) + (dto.getTeacherNum() + dto.getStudentNum()));
-                this.updateById(updateTotalNum);
-            }
+        }
+
+
+        // 变更征订总数量
+        TextbookSubscription updateTotalNum = new TextbookSubscription();
+        if(ObjectUtils.isNotEmpty(textbookSubscription)){
+            updateTotalNum.setId(textbookSubscription.getId());
+            updateTotalNum.setSum((ObjectUtils.isNotEmpty(textbookSubscription.getSum()) ? textbookSubscription.getSum() : 0)
+                    + ((ObjectUtils.isNotEmpty(dto.getStudentNum()) ? dto.getStudentNum() : 0)
+                    - (ObjectUtils.isNotEmpty(old.getStudentNum()) ? old.getStudentNum() : 0))
+                    + ((ObjectUtils.isNotEmpty(dto.getTeacherNum()) ? dto.getTeacherNum() : 0)
+                    - (ObjectUtils.isNotEmpty(old.getTeacherNum()) ? old.getTeacherNum() : 0))
+            );
+            updateTotalNum.setModifyDate(new Date());
+            this.updateById(updateTotalNum);
         }
 
         // 将历史记录保存到历史变更记录表
@@ -943,9 +944,6 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
         textbookSubscriptionItemHistory.setAlterationType(alterationType);
         textbookSubscriptionItemHistoryMapper.insert(textbookSubscriptionItemHistory);
 
-        // 变更征订总数量
-
-
         //变更当前记录
         TextbookSubscriptionItem updateItem = new TextbookSubscriptionItem();
         BeanUtils.copyProperties(dto, updateItem);
@@ -1056,7 +1054,7 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
 
         // 提示必填
         String cautionHead = "说明:教材的基础信息不能修改,请输入实际折扣和入库数量,然后直接导入当前excel";
-        ImportExcelUtil.createCautionHead(workbook, sheet, 1, cautionHead, importConfigs.size() - 1, 12);
+        ImportExcelUtil.createCautionHead(workbook, sheet, 1, cautionHead, importConfigs.size() - 1, 12, IndexedColors.RED.getIndex());
 
         // 表头
         ImportExcelUtil.createHead(workbook, sheet, importConfigs, 2);

+ 10 - 8
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookWarehouseRecordServiceImpl.java

@@ -69,7 +69,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
                 .select(TextbookWarehouseRecord::getId)
                 .selectAs(TextbookWarehouseRecord::getPrice, TextbookWarehouseRecordPageVo::getPrice)
                 .selectAs(TextbookWarehouseRecord::getDiscount, TextbookWarehouseRecordPageVo::getDiscount)
-                .selectAs(TextbookWarehouseRecord::getCreateDate, TextbookWarehouseRecordPageVo::getCreateDate)
+                .selectAs(TextbookWarehouseRecord::getCreateDate, TextbookWarehouseRecordPageVo::getCreateDateStr)
                 .selectAs(TextbookWarehouseRecord::getSubtotal, TextbookWarehouseRecordPageVo::getSubtotal)
                 .select(Textbook.class,x -> VoToColumnUtil.fieldsToColumns(TextbookWarehouseRecordPageVo.class).contains(x.getProperty()))
                 .select(TextbookWarehouseRecord.class,x -> VoToColumnUtil.fieldsToColumns(TextbookWarehouseRecordPageVo.class).contains(x.getProperty()))
@@ -107,10 +107,11 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
                 .eq(StringUtils.isNotEmpty(dto.getIssn()), Textbook::getIssn, dto.getIssn())
                 .like(StringUtils.isNotEmpty(dto.getGroupName()), SubjectGroup::getGroupName, dto.getGroupName())
                 .eq(ObjectUtils.isNotEmpty(dto.getUseType()), Textbook::getUseType, dto.getUseType())
-                .between(ObjectUtils.isNotEmpty(dto.getStartCreateDate()) && ObjectUtils.isNotEmpty(dto.getEndCreateDate()), TextbookWarehouseRecord::getCreateDate, dto.getStartCreateDate(), dto.getEndCreateDate())
+                .ge(ObjectUtils.isNotEmpty(dto.getStartCreateDate()), TextbookWarehouseRecord::getCreateDate, dto.getStartCreateDate())
+                .le(ObjectUtils.isNotEmpty(dto.getEndCreateDate()), TextbookWarehouseRecord::getCreateDate, dto.getEndCreateDate())
                 .gt(ObjectUtils.isNotEmpty(dto.getReturnBookstore()) && dto.getReturnBookstore() == 1, TextbookWarehouseRecord::getReturnBookstoreNumber, 0)
                 .gt(ObjectUtils.isNotEmpty(dto.getReturnState()) && dto.getReturnState() == 1, TextbookWarehouseRecord::getRecedeNumber, 0)
-                .orderByDesc(TextbookWarehouseRecord::getCreateDate)
+//                .orderByDesc(TextbookWarehouseRecord::getCreateDate)
                 ;
         return this.selectJoinListPage(ConventPage.getPage(dto), TextbookWarehouseRecordPageVo.class, textbookWarehouseRecordMPJLambdaWrapper);
 //        return textbookWarehouseRecordMapper.getPage(page, dto);
@@ -148,6 +149,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
 
         TextbookWarehouseRecord textbookWarehouseRecord;
         TextbookWarehouseRecordDetail textbookWarehouseRecordDetail;
+        Date nowDate = new Date();
         for (TextbookWarehouseTextbooksDto td : dto.getTextbookWarehouseTextbooksDtos()){
             //新增入库记录
             long textbookWarehouseRecordId = IdUtil.getSnowflakeNextId();
@@ -157,7 +159,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
             textbookWarehouseRecord.setBaseSemesterId(dto.getBaseSemesterId());
             textbookWarehouseRecord.setWarehouseNumber(td.getWarehouseNumber());
             textbookWarehouseRecord.setPrice(td.getPrice());
-            textbookWarehouseRecord.setDiscount(td.getDiscount());
+            textbookWarehouseRecord.setDiscount(ObjectUtils.isNotEmpty(td.getDiscount()) ? td.getDiscount() : 10);
             textbookWarehouseRecord.setSubtotal(td.getPrice().multiply(BigDecimal.valueOf(td.getDiscount() / 10)));
             textbookWarehouseRecord.setTotalPrice(textbookWarehouseRecord.getSubtotal().multiply(BigDecimal.valueOf(td.getWarehouseNumber())));
             oldOrderInteger += 1;
@@ -170,7 +172,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
             textbookWarehouseRecord.setRecedeNumber(0);
             textbookWarehouseRecord.setRemainNumber(textbookWarehouseRecord.getActualWarehouseNumber());
             textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
-            textbookWarehouseRecord.setCreateDate(new Date());
+            textbookWarehouseRecord.setCreateDate(nowDate);
             textbookWarehouseRecord.setCreateUserId(StpUtil.getLoginIdAsLong());
             textbookWarehouseRecordMapper.insert(textbookWarehouseRecord);
 
@@ -179,7 +181,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
             textbookWarehouseRecordDetail.setTextbookWarehouseRecordId(textbookWarehouseRecordId);
             textbookWarehouseRecordDetail.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
             textbookWarehouseRecordDetail.setWarehouseNumber(td.getWarehouseNumber());
-            textbookWarehouseRecordDetail.setCreateDate(new Date());
+            textbookWarehouseRecordDetail.setCreateDate(nowDate);
             textbookWarehouseRecordDetailMapper.insert(textbookWarehouseRecordDetail);
         }
         return true;
@@ -217,7 +219,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
         if(ObjectUtils.isNotEmpty(textbookSubscriptionItem)){
             TextbookSubscriptionItem updateTextbookSubscriptionItem = new TextbookSubscriptionItem();
             updateTextbookSubscriptionItem.setId(textbookSubscriptionItem.getId());
-            updateTextbookSubscriptionItem.setDiscount(dto.getDiscount());
+            updateTextbookSubscriptionItem.setDiscount(ObjectUtils.isNotEmpty(dto.getDiscount()) ? dto.getDiscount() : 10);
             updateTextbookSubscriptionItem.setPrice(textbookWarehouseRecord.getPrice().multiply(BigDecimal.valueOf(dto.getDiscount() / 10)));
             updateTextbookSubscriptionItem.setModifyDate(new Date());
             textbookSubscriptionItemMapper.updateById(updateTextbookSubscriptionItem);
@@ -225,7 +227,7 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
 
         TextbookWarehouseRecord updateTextbookWarehouseRecord = new TextbookWarehouseRecord();
         updateTextbookWarehouseRecord.setId(textbookWarehouseRecord.getId());
-        updateTextbookWarehouseRecord.setDiscount(dto.getDiscount());
+        updateTextbookWarehouseRecord.setDiscount(ObjectUtils.isNotEmpty(dto.getDiscount()) ? dto.getDiscount() : 10);
         updateTextbookWarehouseRecord.setSubtotal(textbookWarehouseRecord.getPrice().multiply(BigDecimal.valueOf(dto.getDiscount() / 10)));
         updateTextbookWarehouseRecord.setTotalPrice(updateTextbookWarehouseRecord.getSubtotal().multiply(BigDecimal.valueOf(textbookWarehouseRecord.getWarehouseNumber())));
         updateTextbookWarehouseRecord.setActualTotalPrice(updateTextbookWarehouseRecord.getSubtotal().multiply(BigDecimal.valueOf(textbookWarehouseRecord.getActualWarehouseNumber())));

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

@@ -197,10 +197,10 @@ public class WfTextbookRecedeServiceImpl extends MPJBaseServiceImpl<WfTextbookRe
                                         + textbookWarehouseRecordDetail.getWarehouseNumber()
                         );
                         updateTextbookIssueRecord.setActualIssueNumber(
-                                (ObjectUtils.isNotEmpty(oldTextbookIssueRecord.getIssueNumber()) ? oldTextbookIssueRecord.getIssueNumber() : 0)
-                                        +  (ObjectUtils.isNotEmpty(oldTextbookIssueRecord.getRecedeNumber()) ? oldTextbookIssueRecord.getRecedeNumber() : 0)
+                                (ObjectUtils.isNotEmpty(oldTextbookIssueRecord.getActualIssueNumber()) ? oldTextbookIssueRecord.getActualIssueNumber() : 0)
+                                        -  textbookWarehouseRecordDetail.getWarehouseNumber()
                         );
-                        updateTextbookIssueRecord.setActualTotalPrice(oldTextbookWarehouseRecord.getSubtotal().multiply(BigDecimal.valueOf(oldTextbookIssueRecord.getActualIssueNumber())));
+                        updateTextbookIssueRecord.setActualTotalPrice(oldTextbookWarehouseRecord.getSubtotal().multiply(BigDecimal.valueOf(updateTextbookIssueRecord.getActualIssueNumber())));
                         updateTextbookIssueRecord.setModifyDate(new Date());
                         textbookIssueRecordMapper.updateById(updateTextbookIssueRecord);
                     }

+ 135 - 134
src/main/java/com/xjrsoft/module/textbook/vo/TextbookClaimRecordExportVo.java

@@ -8,6 +8,7 @@ import lombok.Data;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.Map;
 
 /**
 * @title: 教材出库记录分页列表出参
@@ -18,138 +19,138 @@ import java.util.Date;
 @Data
 public class TextbookClaimRecordExportVo {
 
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("学期")
-//    @ApiModelProperty("学期")
-//    public String baseSemesterIdCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("出库单号")
-//    @ApiModelProperty("出库单号")
-//    public String orderNumber;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("入库单号")
-//    @ApiModelProperty("入库单号")
-//    public String warehouseOrderNumber;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("出库方式")
-//    @ApiModelProperty("出库方式")
-//    private String issueModeCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("书号")
-//    @ApiModelProperty("书号")
-//    private String issn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("书名")
-//    @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 courseName;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("教材类型")
-//    @ApiModelProperty("类型")
-//    private String textbookTypeCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelIgnore
-//    @ApiModelProperty("是否为规划教材")
-//    private Integer isTextbookPlan;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("规划教材")
-//    @ApiModelProperty("是否为规划教材")
-//    private String isTextbookPlanCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("使用时长(单位:学期)")
-//    @ApiModelProperty("使用类型(单位:学期)")
-//    private Integer useType;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("定价(元)")
-//    @ApiModelProperty("定价(元)")
-//    private BigDecimal price;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("实际价格(元)")
-//    @ApiModelProperty("实际价格(元)")
-//    private BigDecimal subtotal;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelIgnore
-//    @ApiModelProperty("出库时间")
-//    private Date createDate;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("出库时间")
-//    @ApiModelProperty("出库时间")
-//    private String createDateCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("领取类型")
-//    @ApiModelProperty("领取类型")
-//    private String claimTypeCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("领取人员")
-//    @ApiModelProperty("领取人员")
-//    private String claimUser;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("年级主键")
-//    @ApiModelProperty("年级主键")
-//    private String gradeIdCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("班级主键")
-//    @ApiModelProperty("班级主键")
-//    private String classIdCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("出库用户编号")
-//    @ApiModelProperty("出库用户编号")
-//    private String issueUserIdCn;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("出库数量")
-//    @ApiModelProperty("出库数量")
-//    private Integer issueNumber;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("领取后退书数量")
-//    @ApiModelProperty("领取后退书数量")
-//    private Integer recedeNumber;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("实际出库数量")
-//    @ApiModelProperty("实际出库数量")
-//    private Integer actualIssueNumber;
-//
-//    @ContentStyle(dataFormat = 49)
-//    @ExcelProperty("实际出库总金额")
-//    @ApiModelProperty("实际出库总金额")
-//    private BigDecimal actualTotalPrice;
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("学期")
+    public Long baseSemesterId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("学期")
+    public String baseSemesterIdCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("班级主键")
+    private Long classId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("班级主键")
+    private String classIdCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("班主任主键")
+    private String teacherIdCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("班主任电话")
+    private String teacherMobile;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("教室")
+    private String classroomIdCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("班级人数")
+    private Integer totalStuNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("类型")
+    private String textbookType;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材类型")
+    @ApiModelProperty("类型")
+    private String textbookTypeCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("教材主键")
+    private Long textbookId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书名")
+    @ApiModelProperty("书名")
+    private String bookName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书号")
+    @ApiModelProperty("书号")
+    private String issn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("作者(主编)")
+    @ApiModelProperty("作者(主编)")
+    private String editorInChief;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("出版社")
+    @ApiModelProperty("出版社")
+    private String publishingHouse;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("定价(元)")
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("实际价格(元)")
+    @ApiModelProperty("实际价格(元)")
+    private BigDecimal subtotal;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("合计(元)")
+    @ApiModelProperty("合计(元)")
+    private BigDecimal summation;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("当前出库对应的申领项的发放次数")
+    private Integer issueTimes;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("出库时间")
+    private Date createDate;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("领取类型")
+    private String claimType;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("出库数量")
+    private Integer issueNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("领取后退书数量")
+    private Integer recedeNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("实际出库数量")
+    private Integer actualIssueNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("实际出库总金额")
+    private BigDecimal actualTotalPrice;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("下发数量")
+    private Map<Integer, Integer> numMap;
 }

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

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -66,7 +67,7 @@ public class TextbookWarehouseRecordPageVo {
     private BigDecimal subtotal;
 
     @ApiModelProperty("入库时间")
-    private Date createDate;
+    private String createDateStr;
 
     @ApiModelProperty("入库人员")
     private String warehouseUser;

+ 103 - 5
src/main/java/com/xjrsoft/module/veb/util/ImportExcelUtil.java

@@ -56,7 +56,7 @@ public class ImportExcelUtil {
 
         // 提示必填
         String content = "红色背景为必填项,导入时请删除本行。";
-        createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12);
+        createCautionHead(workbook, sheet, 1, content, importConfigs.size() - 1, 12, IndexedColors.RED.getIndex());
 
         //写入文件
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
@@ -125,6 +125,18 @@ public class ImportExcelUtil {
         normalCellStyle.setFont(font); // 将字体应用到样式
         normalCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
         normalCellStyle.setAlignment(HorizontalAlignment.CENTER);
+        // 设置边框样式为细线
+        normalCellStyle.setBorderTop(BorderStyle.THIN);
+        normalCellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        normalCellStyle.setBorderBottom(BorderStyle.THIN);
+        normalCellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        normalCellStyle.setBorderLeft(BorderStyle.THIN);
+        normalCellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        normalCellStyle.setBorderRight(BorderStyle.THIN);
+        normalCellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
 
         // 所在行
         Row row = sheet.createRow(rowNumber);
@@ -153,6 +165,19 @@ public class ImportExcelUtil {
         normalCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
         normalCellStyle.setAlignment(HorizontalAlignment.CENTER);
 
+        // 设置边框样式为细线
+        normalCellStyle.setBorderTop(BorderStyle.THIN);
+        normalCellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        normalCellStyle.setBorderBottom(BorderStyle.THIN);
+        normalCellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        normalCellStyle.setBorderLeft(BorderStyle.THIN);
+        normalCellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        normalCellStyle.setBorderRight(BorderStyle.THIN);
+        normalCellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
+
         // 必填样式
         CellStyle requiredCellStyle = workbook.createCellStyle();
         requiredCellStyle.setFont(font); // 将字体应用到样式
@@ -161,6 +186,19 @@ public class ImportExcelUtil {
         requiredCellStyle.setFillForegroundColor(IndexedColors.RED.getIndex());//设置背景颜色
         requiredCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);//设置填充模式
 
+        // 设置边框样式为细线
+        requiredCellStyle.setBorderTop(BorderStyle.THIN);
+        requiredCellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        requiredCellStyle.setBorderBottom(BorderStyle.THIN);
+        requiredCellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        requiredCellStyle.setBorderLeft(BorderStyle.THIN);
+        requiredCellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        requiredCellStyle.setBorderRight(BorderStyle.THIN);
+        requiredCellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
+
         // 所在行
         Row row = sheet.createRow(rowNumber);
 
@@ -178,6 +216,53 @@ public class ImportExcelUtil {
         }
     }
 
+    /**
+     * 写单格
+     * @param workbook
+     * @param sheet
+     * @param content
+     * @param rowNumber
+     * @param starRow
+     * @param endRow
+     * @param startcol
+     * @param lastCol
+     * @param fontSize
+     * @param indexedColor
+     */
+    public static void createOneCell(Workbook workbook, Sheet sheet, String content, int rowNumber, int starRow, int endRow, int startcol, int lastCol, short fontSize, short indexedColor, HorizontalAlignment horizontalAlignment) {
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints(fontSize);
+        font.setColor(indexedColor);
+
+        // 正常样式
+        CellStyle normalCellStyle = workbook.createCellStyle();
+        normalCellStyle.setFont(font); // 将字体应用到样式
+        normalCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        normalCellStyle.setAlignment(horizontalAlignment);
+
+        // 设置边框样式为细线
+        normalCellStyle.setBorderTop(BorderStyle.THIN);
+        normalCellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        normalCellStyle.setBorderBottom(BorderStyle.THIN);
+        normalCellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        normalCellStyle.setBorderLeft(BorderStyle.THIN);
+        normalCellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        normalCellStyle.setBorderRight(BorderStyle.THIN);
+        normalCellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
+
+        // 所在行
+        Row row = sheet.createRow(rowNumber);
+
+        Cell cell = row.createCell(0);
+        cell.setCellValue(content);
+        cell.setCellStyle(normalCellStyle);
+        sheet.addMergedRegion(new CellRangeAddress(starRow, endRow, startcol, lastCol));
+    }
+
     /**
      * 写提示行
      * @param workbook
@@ -185,17 +270,30 @@ public class ImportExcelUtil {
      * @param rowNumber
      * @param content
      * @param lastCol
-     * @param size
+     * @param fontSize
      */
-    public static void createCautionHead(Workbook workbook, Sheet sheet, int rowNumber, String content, int lastCol, int size) {
+    public static void createCautionHead(Workbook workbook, Sheet sheet, int rowNumber, String content, int lastCol, int fontSize, short indexedColor) {
         Font font = workbook.createFont();
         font.setFontName("宋体");
-        font.setFontHeightInPoints((short)size);
-        font.setColor(IndexedColors.RED.getIndex());
+        font.setFontHeightInPoints((short)fontSize);
+        font.setColor(indexedColor);
+//        font.setColor(IndexedColors.RED.getIndex());
 
         CellStyle cellStyle = workbook.createCellStyle();
         cellStyle.setFont(font); // 将字体应用到样式
 
+        cellStyle.setBorderTop(BorderStyle.THIN);
+        cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); // 设置顶部边框颜色
+
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); // 设置底部边框颜色
+
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); // 设置左边框颜色
+
+        cellStyle.setBorderRight(BorderStyle.THIN);
+        cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); // 设置右边框颜色
+
         Row row = sheet.createRow(rowNumber);
         Cell cell = row.createCell(0);
         cell.setCellValue(content);

+ 18 - 0
src/main/resources/sqlScript/textbook_sql.sql

@@ -457,5 +457,23 @@ create table `textbook_discount_alter_record`
   default charset = utf8mb4
   collate = utf8mb4_0900_ai_ci comment ='教材折扣变更记录';
 
+alter table wf_textbook_recede_item
+    change textbook_issue_record_id textbook_issue_order_number varchar(256) null comment '出库订单号';
+
+alter table wf_textbook_recede_item
+    add textbook_issue_record_id bigint null comment '出库记录主键' after wf_textbook_recede_id;
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 

+ 24 - 0
src/test/java/com/xjrsoft/module/textbook/service/impl/TextbookIssueRecordServiceImplTest.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.textbook.service.impl;
+
+import com.xjrsoft.module.textbook.dto.TextbookClaimRecordExportDto;
+import com.xjrsoft.module.textbook.service.ITextbookIssueRecordService;
+import com.xjrsoft.module.textbook.service.ITextbookService;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@SpringBootTest
+class TextbookIssueRecordServiceImplTest {
+
+    @Autowired
+    private ITextbookIssueRecordService textbookIssueRecordService;
+
+    @Test
+    void claimRecordExportDataQuery() throws IOException {
+        textbookIssueRecordService.claimRecordExportDataQuery(new TextbookClaimRecordExportDto());
+    }
+}

+ 1 - 1
src/test/java/com/xjrsoft/module/textbook/service/impl/WfTextbookRecedeServiceImplTest.java

@@ -19,6 +19,6 @@ class WfTextbookRecedeServiceImplTest {
 
     @Test
     void dataHandle() {
-        wfTextbookRecedeService.dataHandle(1890396119899357184L);
+        wfTextbookRecedeService.dataHandle(1893987152298057728L);
     }
 }