瀏覽代碼

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

dzx 1 年之前
父節點
當前提交
4b9edfa4ac

+ 25 - 35
src/main/java/com/xjrsoft/module/textbook/controller/TextbookController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.TextbookTypeEnum;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
@@ -16,45 +17,20 @@ import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClassCourse;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
-import com.xjrsoft.module.base.entity.BaseSemester;
-import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.student.entity.BaseClassMajorSet;
-import com.xjrsoft.module.textbook.dto.AddTextbookDto;
-import com.xjrsoft.module.textbook.dto.AddTextbookWarehouseRecordDto;
-import com.xjrsoft.module.textbook.dto.TextbookClaimExportQueryDto;
-import com.xjrsoft.module.textbook.dto.TextbookConsumptionPageDto;
-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.dto.TextbookSubscriptionListDto;
-import com.xjrsoft.module.textbook.dto.UpdateTextbookDto;
+import com.xjrsoft.module.student.service.IBaseClassMajorSetService;
+import com.xjrsoft.module.textbook.dto.*;
 import com.xjrsoft.module.textbook.entity.Textbook;
 import com.xjrsoft.module.textbook.entity.TextbookClassRelation;
 import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
 import com.xjrsoft.module.textbook.service.ITextbookService;
 import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
-import com.xjrsoft.module.textbook.vo.TextbookConsumptionPageVo;
-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.TextbookSubscriptionExportQueryVo;
-import com.xjrsoft.module.textbook.vo.TextbookSubscriptionListVo;
-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 io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 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 org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
@@ -79,10 +55,11 @@ public class TextbookController {
 
     private final ITextbookService textbookService;
 
-    private final IBaseSemesterService baseSemesterService;
-
     private final ITextbookStudentClaimService textbookStudentClaimService;
 
+
+    private final IBaseClassMajorSetService baseClassMajorSetService;
+
     @GetMapping(value = "/page")
     @ApiOperation(value="教材管理列表(分页)")
     @SaCheckPermission("textbook:detail")
@@ -107,21 +84,34 @@ public class TextbookController {
                 .select(Textbook::getId)
                 .selectAs(Textbook::getId,TextbookSubscriptionListVo::getTextbookId)
                 .selectAs(BaseCourseSubject::getName, TextbookSubscriptionListVo::getCourseName)
-                .selectSum(BaseClassMajorSet::getTotalStudent, TextbookSubscriptionListVo::getStudentSubscriptionNumber)
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(TextbookSubscriptionListVo.class).contains(x.getProperty()))
                 .leftJoin(BaseClassCourse.class, BaseClassCourse::getCourseId, Textbook::getCourseSubjectId)
-                .leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClassCourse::getClassId)
                 .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId)
                 .eq(dto.getBaseSemesterId() != null && dto.getBaseSemesterId() > 0, BaseClassCourse::getBaseSemesterId, dto.getBaseSemesterId())
                 .in(!classIdList.isEmpty(),BaseClassCourse::getClassId, classIdList)
                 .groupBy(Textbook::getId)
         ;
         IPage<TextbookSubscriptionListVo> page = textbookService.selectJoinListPage(ConventPage.getPage(dto),TextbookSubscriptionListVo.class,textbookMPJLambdaWrapper);
+
+        //获取所有班级的总人数
+        LambdaQueryWrapper<BaseClassMajorSet> baseClassMajorSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        baseClassMajorSetLambdaQueryWrapper
+                .in(!classIdList.isEmpty(), BaseClassMajorSet::getClassId, classIdList)
+                .eq(BaseClassMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode())
+                ;
+        List<BaseClassMajorSet> baseClassMajorSetList = baseClassMajorSetService.list(baseClassMajorSetLambdaQueryWrapper);
+
+        int studentSubscriptionNumber = 0;
+        for (BaseClassMajorSet baseClassMajorSet : baseClassMajorSetList){
+            studentSubscriptionNumber += baseClassMajorSet.getTotalStudent();
+        }
+
         for(TextbookSubscriptionListVo t : page.getRecords()){
             t.setClassIds(dto.getClassIds());
-            if(t.getTextbookType() != null && !t.getTextbookType().equals("")){
+            if(t.getTextbookType() != null && !("").equals(t.getTextbookType())){
                 t.setTextbookTypeCn(TextbookTypeEnum.getValue(t.getTextbookType()));
             }
+            t.setStudentSubscriptionNumber(studentSubscriptionNumber);
         }
         PageOutput<TextbookSubscriptionListVo> pageOutput = ConventPage.getPageOutput(page, TextbookSubscriptionListVo.class);
         return RT.ok(pageOutput);
@@ -155,7 +145,7 @@ public class TextbookController {
     @GetMapping(value = "/List-subscription")
     @ApiOperation(value="教材管理列表(不分页,教材征订用)")
     @SaCheckPermission("textbook:detail")
-    public RT<List<TextbookSubscriptionListVo>> ListSubscription(@Valid TextbookSubscriptionListDto dto){
+    public RT<List<TextbookSubscriptionListVo>> listSubscription(@Valid TextbookSubscriptionListDto dto){
         List<String> classIdList = new ArrayList<>();
         if(dto.getClassIds() != null && !dto.getClassIds().equals("")){
             String[] classIdArr =  dto.getClassIds().split(",");

+ 5 - 3
src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookSubscriptionItemHistoryController.java

@@ -9,6 +9,7 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.textbook.dto.AddWfTextbookSubscriptionItemHistoryDto;
 import com.xjrsoft.module.textbook.dto.UpdateWfTextbookSubscriptionItemHistoryDto;
@@ -51,15 +52,16 @@ public class WfTextbookSubscriptionItemHistoryController {
                 .select(WfTextbookSubscriptionItemHistory::getId)
                 .selectAs(BaseCourseSubject::getName, WfTextbookSubscriptionItemHistoryPageVo::getCourseName)
                 .selectAs(XjrUser::getName, WfTextbookSubscriptionItemHistoryPageVo::getCreateUserIdCn)
-                .select(WfTextbookSubscriptionItemHistory.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
+                .select(WfTextbookSubscriptionItemHistory.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemHistoryPageVo.class).contains(x.getProperty()))
                 .leftJoin(Textbook.class, Textbook::getId, WfTextbookSubscriptionItemHistory::getTextbookId)
-//                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
-//                        ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemHistoryPageVo::getTextbookTypeCn))
+                .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
+                        ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemHistoryPageVo::getTextbookTypeCn))
                 .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId)
                 .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())
+                .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())
                 .orderByAsc("t.wf_textbook_subscription_item_id, t.history_version")

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

@@ -62,7 +62,7 @@ public class TextbookImportDto {
      * 教材类型(xjr_dictionary_item[textbook_type])
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("类型(教材、辅、作业本)")
+    @ExcelProperty("类型(教材、辅、作业本)")
     @ApiModelProperty("教材类型-中文")
     private String textbookTypeCn;
     /**

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

@@ -41,4 +41,9 @@ public class WfTextbookSubscriptionItemHistoryPageDto extends PageInput {
      */
     @ApiModelProperty("课程编号(base_course_subject)")
     private String courseSubjectIdCn;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookType;
 }

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

@@ -99,6 +99,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
         BeanUtils.copyProperties(textbook, textbookCoreAttribute);
         textbookCoreAttributeMapper.insert(textbookCoreAttribute);
         textbook.setTextbookCoreAttributeId(textbookCoreAttribute.getId());
+        textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(textbook.getDiscount()/10)));
         textbookTextbookMapper.insert(textbook);
         for (TextbookClassRelation textbookClassRelation : textbook.getTextbookClassRelationList()) {
             textbookClassRelation.setTextbookId(textbook.getId());
@@ -766,7 +767,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             }});
             //sheet的表头合并策略
             ExcelFillCellMergePrevColUtil sheetHeadColumn = new ExcelFillCellMergePrevColUtil();
-            sheetHeadColumn.add(rowIndex, 0, 9);
+            sheetHeadColumn.add(rowIndex, 0, 12);
             //这是一个sheet表头的table
             WriteTable writeSheetHeadTable = EasyExcel.writerTable(tableIndex).needHead(Boolean.TRUE).head(sheetHeadList).registerWriteHandler(sheetHeadColumn).build();
             excelWriter.write(new ArrayList<>(), writeSheet, writeSheetHeadTable);
@@ -947,6 +948,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             //处理使用类型
             textbook.setUseType(UseSemesterTypeEnum.getCode(textbookImportDto.getUseTypeCn()));
 
+            //处理小计
+            textbook.setSubtotal(textbook.getPrice().multiply(BigDecimal.valueOf(textbook.getDiscount()/10)));
+
             // 判断导入的教材是否已经存在,根据教材的 ISBN 码和使用的学期判断
             LambdaQueryWrapper<Textbook> textbookLambdaQueryWrapper = new LambdaQueryWrapper<>();
             textbookLambdaQueryWrapper
@@ -992,26 +996,26 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
             throw new MyException("入库失败,该教材不存在");
         }
 
-        BigDecimal price = ObjectUtil.isNull(dto.getPrice()) ? new BigDecimal(0) : dto.getPrice();
-        Double discount = ObjectUtil.isNull(dto.getDiscount()) ? 10 : dto.getDiscount();
-        BigDecimal subtotal = price.multiply(new BigDecimal(discount / 10));
+//        BigDecimal price = ObjectUtil.isNull(dto.getPrice()) ? new BigDecimal(0) : dto.getPrice();
+//        double discount = ObjectUtil.isNull(dto.getDiscount()) ? 10 : dto.getDiscount();
+//        BigDecimal subtotal = price.multiply(new BigDecimal(discount / 10));
         //更新总的库存数量
         this.updateById(new Textbook() {
             {
                 setId(textbook.getId());
                 Integer oldStock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
                 setStock(oldStock + (ObjectUtil.isNull(dto.getWarehouseNumber()) ? 0 : dto.getWarehouseNumber()));
-                setPrice(price);
-                setDiscount(discount);
-                setSubtotal(subtotal);
+//                setPrice(price);
+//                setDiscount(discount);
+//                setSubtotal(subtotal);
                 setModifyDate(new Date());
             }
         });
         //添加入库记录
         TextbookWarehouseRecord textbookWarehouseRecord = BeanUtil.toBean(dto, TextbookWarehouseRecord.class);
         textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
-        textbookWarehouseRecord.setDiscount(discount);
-        textbookWarehouseRecord.setSubtotal(subtotal);
+        textbookWarehouseRecord.setDiscount(textbook.getDiscount());
+        textbookWarehouseRecord.setSubtotal(textbook.getSubtotal());
         textbookWarehouseRecord.setCreateDate(new Date());
         QueryWrapper<TextbookWarehouseRecord> queryWrapperSortcode = new QueryWrapper<>();
         queryWrapperSortcode.select("IFNULL(MAX(sort_code),0) as sortCode");
@@ -1021,6 +1025,4 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
         return true;
     }
-
-
 }

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

@@ -204,8 +204,8 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         mpjLambdaWrapper
                 .select(WfTextbookSubscriptionItem::getId)
                 .selectAs(BaseCourseSubject::getName, WfTextbookSubscriptionItemVo::getCourseSubjectIdCn)
-                .select(WfTextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
                 .select(Textbook.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
+                .select(WfTextbookSubscriptionItem.class, x -> VoToColumnUtil.fieldsToColumns(WfTextbookSubscriptionItemVo.class).contains(x.getProperty()))
                 .leftJoin(Textbook.class, Textbook::getId, WfTextbookSubscriptionItem::getTextbookId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
                         ext -> ext.selectAs(DictionaryDetail::getName, WfTextbookSubscriptionItemVo::getTextbookTypeCn))
@@ -246,15 +246,19 @@ public class WfTextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<WfText
         int stuSum = 0;
         int teaSum = 0;
         for (WfTextbookSubscriptionItemVo w : itemList) {
+            int sum = 0;
             if (!classIdList.isEmpty()) {
                 w.setClassNum(classIdList.size());
             }
             if (w.getStudentSubscriptionNumber() != null) {
                 stuSum += w.getStudentSubscriptionNumber();
+                sum += w.getStudentSubscriptionNumber();
             }
             if (w.getTeacherSubscriptionNumber() != null) {
                 teaSum += w.getTeacherSubscriptionNumber();
+                sum += w.getTeacherSubscriptionNumber();
             }
+            w.setSumNumber(sum);
         }
 
         wfTextbookSubscriptionVo.setClassIdsCn(sb.toString());

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

@@ -39,6 +39,21 @@ public class TextbookSubscriptionListVo {
     */
     @ApiModelProperty("书名")
     private String bookName;
+    /**
+     * 国际标准刊号
+     */
+    @ApiModelProperty("国际标准刊号")
+    private String issn;
+    /**
+     * 主编
+     */
+    @ApiModelProperty("主编")
+    private String editorInChief;
+    /**
+     * 版本
+     */
+    @ApiModelProperty("版本")
+    private String version;
     /**
     * 出版社
     */

+ 10 - 0
src/main/java/com/xjrsoft/module/textbook/vo/WfTextbookSubscriptionItemHistoryPageVo.java

@@ -80,6 +80,16 @@ public class WfTextbookSubscriptionItemHistoryPageVo {
     */
     @ApiModelProperty("主编")
     private String editorInChief;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookType;
+    /**
+     * 教材类型(xjr_dictionary_item[textbook_type])
+     */
+    @ApiModelProperty("教材类型(xjr_dictionary_item[textbook_type])")
+    private String textbookTypeCn;
     /**
     * 估价(元)
     */

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

@@ -117,8 +117,8 @@ public class WfTextbookSubscriptionItemVo {
     /**
     * 教师教参用书征订数量
     */
-    @ApiModelProperty("教师教参用书征订数量")
-    private Integer teacherReferenceNumber;
+    @ApiModelProperty("征订数量")
+    private Integer sumNumber;
     /**
     * 是否有配套教学资源(xjr_dictionary_item[judgment_method_1])
     */

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

@@ -126,8 +126,8 @@ mybatis-plus:
     cache-enabled: false
     call-setters-on-nulls: true
     jdbc-type-for-null: 'null'
-    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 camunda:
   bpm: