Pārlūkot izejas kodu

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

dzx 9 mēneši atpakaļ
vecāks
revīzija
873869341e

+ 13 - 0
src/main/java/com/xjrsoft/module/textbook/controller/TextbookSubscriptionController.java

@@ -232,6 +232,19 @@ public class TextbookSubscriptionController {
         return RT.fileStream(bot.toByteArray(), "TextbookSubscription" + ExcelTypeEnum.XLSX.getValue());
     }
 
+    @PostMapping("/subscription-export-query")
+    @ApiOperation(value = "教材征订导出")
+    public ResponseEntity<byte[]> subscriptionExportQuery(@Valid @RequestBody SubscriptionExportQueryDto dto) throws IOException {
+//    @GetMapping("/subscription-export-query")
+//    @ApiOperation(value = "教材征订导出")
+//    public ResponseEntity<byte[]> subscriptionExportQuery(@Valid SubscriptionExportQueryDto dto) throws IOException {
+        ByteArrayOutputStream bot = textbookSubscriptionService.subscriptionExportQuery(dto);
+
+        String fileName = "征订详情";
+        fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8);
+        return RT.fileStream(bot.toByteArray(), fileName + ExcelTypeEnum.XLSX.getValue());
+    }
+
     @PostMapping("/subscription-instockroom-export-query")
     @ApiOperation(value = "教材征订教材入库模板条件导出")
     public ResponseEntity<byte[]> subscriptionInstockroomExportQuery(@Valid @RequestBody TextbookSubscriptionExportQueryListDto dto) throws IOException {

+ 16 - 0
src/main/java/com/xjrsoft/module/textbook/dto/SubscriptionExportQueryDto.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.textbook.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SubscriptionExportQueryDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 教材教辅增订记录表主键(textbook_subscription)
+     */
+    @ApiModelProperty("教材教辅增订记录表主键(textbook_subscription)")
+    private Long textbookSubscriptionId;
+}

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

@@ -90,4 +90,6 @@ public interface ITextbookSubscriptionService extends MPJBaseService<TextbookSub
     Boolean delete(List<Long> ids);
 
     ByteArrayOutputStream textbookSubscriptionExportQuery(TextbookSubscriptionExportQueryListDto dto) throws IOException;
+
+    ByteArrayOutputStream subscriptionExportQuery(SubscriptionExportQueryDto dto) throws IOException;
 }

+ 74 - 0
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookSubscriptionServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.db.Entity;
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -17,6 +18,7 @@ import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.UseSemesterTypeEnum;
 import com.xjrsoft.common.enums.WarehouseModeEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.page.ConventPage;
@@ -27,6 +29,7 @@ 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.courseTable.entity.CourseTable;
 import com.xjrsoft.module.generator.constant.ComponentTypeConstant;
 import com.xjrsoft.module.generator.entity.ColumnConfig;
 import com.xjrsoft.module.generator.entity.ImportConfig;
@@ -1142,4 +1145,75 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
         workbook.write(bot);
         return bot;
     }
+
+    @Override
+    public ByteArrayOutputStream subscriptionExportQuery(SubscriptionExportQueryDto dto) throws IOException {
+        MPJLambdaWrapper<TextbookSubscriptionItem> textbookSubscriptionItemMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        textbookSubscriptionItemMPJLambdaWrapper
+                .disableSubLogicDel()
+                .selectAs(TextbookSubscriptionItem::getId, SubscriptionExportQueryListVo::getTextbookSubscriptionItemId)
+                .selectAs(Textbook::getPrice, SubscriptionExportQueryListVo::getPrice)
+                .selectAs(TextbookSubscriptionItem::getPrice, SubscriptionExportQueryListVo::getSubtotal)
+                .select("(SELECT GROUP_CONCAT(DISTINCT b.name)\n" +
+                        "        FROM textbook_subscription_item_class a\n" +
+                        "                 LEFT JOIN base_class b ON (b.id = a.base_class_id)\n" +
+                        "        WHERE a.delete_mark = 0\n" +
+                        "            and a.textbook_subscription_item_id = t.id) AS useClass"
+                )
+                .select("(SELECT GROUP_CONCAT(DISTINCT c.name)\n" +
+                        "        FROM textbook_subscription_item_class a\n" +
+                        "                 LEFT JOIN base_class b ON (b.id = a.base_class_id)\n" +
+                        "                 LEFT JOIN base_grade c ON (c.id = b.grade_id)\n" +
+                        "        WHERE a.delete_mark = 0\n" +
+                        "          and a.textbook_subscription_item_id = t.id) AS useGrade"
+                )
+                .select("(SELECT count(a.id)\n" +
+                        "        FROM textbook_subscription_item_class a\n" +
+                        "        WHERE a.delete_mark = 0\n" +
+                        "          and a.textbook_subscription_item_id = t.id) AS useClassNum"
+                )
+                .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(SubscriptionExportQueryListVo.class).contains(x.getProperty()))
+                .select(TextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(SubscriptionExportQueryListVo.class).contains(x.getProperty()))
+                .leftJoin(Textbook.class, Textbook::getId, TextbookSubscriptionItem::getTextbookId,
+                        wrapper -> wrapper
+                                .leftJoin(SubjectGroup.class, SubjectGroup::getId, Textbook::getSubjectGroupId,
+                                        wrap -> wrap
+                                                .selectAs(SubjectGroup::getGroupName, SubscriptionExportQueryListVo::getSubjectName)
+                                        )
+                                .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId,
+                                        wrap -> wrap
+                                                .selectAs(BaseCourseSubject::getName, SubscriptionExportQueryListVo::getCourseName)
+                                        )
+                                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                                        wrap -> wrap
+                                                .selectAs(DictionaryDetail::getName, SubscriptionExportQueryListVo::getTextbookTypeCn)
+                                        )
+                        )
+                .eq(TextbookSubscriptionItem::getTextbookSubscriptionId, dto.getTextbookSubscriptionId())
+                ;
+        List<SubscriptionExportQueryListVo> dataList = textbookSubscriptionTextbookSubscriptionItemMapper.selectJoinList(SubscriptionExportQueryListVo.class, textbookSubscriptionItemMPJLambdaWrapper);
+
+        for (SubscriptionExportQueryListVo vo : dataList){
+            if(ObjectUtils.isNotEmpty(vo.getIsTextbookPlan()) && vo.getIsTextbookPlan() == 0){
+                vo.setIsTextbookPlanCn("否");
+            }
+            if(ObjectUtils.isNotEmpty(vo.getIsTextbookPlan()) && vo.getIsTextbookPlan() == 1){
+                vo.setIsTextbookPlanCn("是");
+            }
+
+            if(ObjectUtils.isNotEmpty(vo.getUseType())){
+                vo.setUseTypeCn(UseSemesterTypeEnum.getValue(vo.getUseType()));
+            }
+
+            vo.setTotalNumber(vo.getStudentNum() + vo.getTeacherNum());
+            vo.setStudentPrice(vo.getSubtotal().multiply(BigDecimal.valueOf(vo.getStudentNum())));
+            vo.setTeacherPrice(vo.getSubtotal().multiply(BigDecimal.valueOf(vo.getTeacherNum())));
+            vo.setTotalPrice(vo.getStudentPrice().add(vo.getTeacherPrice()));
+        }
+
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        EasyExcel.write(bot, SubscriptionExportQueryListVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
+
+        return bot;
+    }
 }

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

@@ -0,0 +1,139 @@
+package com.xjrsoft.module.textbook.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.xjrsoft.common.annotation.Required;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+* @title: 教材教辅征订项表单出参
+* @Author szs
+* @Date: 2024-06-04
+* @Version 1.0
+*/
+@Data
+public class SubscriptionExportQueryListVo {
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("征订项编号")
+    private String textbookSubscriptionItemId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材书名")
+    @ApiModelProperty("书名")
+    private String bookName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("书号(ISSN)")
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("所属学科组")
+    @ApiModelProperty("所属学科组")
+    private String subjectName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("课程名称")
+    @ApiModelProperty("课程")
+    private String courseName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("出版社")
+    @ApiModelProperty("出版社")
+    private String publishingHouse;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("作者(主编)")
+    @ApiModelProperty("主编")
+    private String editorInChief;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("是否为规划教材")
+    private Integer isTextbookPlan;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("是否为规划教材")
+    @ApiModelProperty("是否为规划教材")
+    private String isTextbookPlanCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelIgnore
+    @ApiModelProperty("使用学期(单位:学期)")
+    private Integer useType;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("使用学期")
+    @ApiModelProperty("使用学期(单位:学期)")
+    private String useTypeCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教材类型")
+    @ApiModelProperty("教材类型")
+    private String textbookTypeCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("定价(元)")
+    @ApiModelProperty("定价(元)")
+    private BigDecimal price;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("小计(元)")
+    @ApiModelProperty("小计(元)")
+    private BigDecimal subtotal;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("使用年级")
+    @ApiModelProperty("使用年级")
+    private String useGrade;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("使用班级")
+    @ApiModelProperty("使用班级")
+    private String useClass;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生用书征订数量")
+    @ApiModelProperty("学生用书征订数量")
+    private Integer studentNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生用书金额")
+    @ApiModelProperty("学生用书金额")
+    private BigDecimal studentPrice;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教师教材征订数量")
+    @ApiModelProperty("教师教材征订数量")
+    private Integer teacherNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("教师用书金额")
+    @ApiModelProperty("教师用书金额")
+    private BigDecimal teacherPrice;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("使用班级数量")
+    @ApiModelProperty("使用班级数量")
+    private Integer useClassNum;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("征订总数量")
+    @ApiModelProperty("征订总数量")
+    private Integer totalNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("总征订金额(元)")
+    @ApiModelProperty("总征订金额(元)")
+    private BigDecimal totalPrice;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("已入库数量")
+    @ApiModelProperty("已经入库数量")
+    private Integer inStockNum;
+}

+ 32 - 0
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionItemClassGradeVo.java

@@ -0,0 +1,32 @@
+package com.xjrsoft.module.textbook.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+* @title: 教材基础信息表分页列表出参
+* @Author dzx
+* @Date: 2024-12-13
+* @Version 1.0
+*/
+@Data
+public class TextbookSubscriptionItemClassGradeVo {
+    /**
+     * 教材征订记录详情表id(textbook_subscription)
+     */
+    @ApiModelProperty("教材征订记录详情表id(textbook_subscription)")
+    private Long textbookSubscriptionItemId;
+    /**
+     * 按班级征订中征订的班级主键(base_class)
+     */
+    @ApiModelProperty("按班级征订中征订的班级主键(base_class)")
+    private String baseClassIdCn;
+    /**
+     * 按班级征订中征订的班级主键(base_class)
+     */
+    @ApiModelProperty("按班级征订中征订的班级主键(base_class)")
+    private String baseGradeIdCn;
+}