|
|
@@ -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;
|