瀏覽代碼

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

dzx 1 年之前
父節點
當前提交
c3d197eb36

+ 3 - 1
src/main/java/com/xjrsoft/module/room/service/impl/RoomBedCheckRecordServiceImpl.java

@@ -222,8 +222,9 @@ public class RoomBedCheckRecordServiceImpl extends MPJBaseServiceImpl<RoomBedChe
         if(classIdList != null && classIdList.size() > 0){
             MPJLambdaWrapper<Room> queryRoomByClass = new MPJLambdaWrapper<>();
             queryRoomByClass
+                    .distinct()
                     .selectAs(Room::getId, RoomEchoVo::getRoomId)
-                    .select("CONCAT(t2.name,\"-\" , t3.name, t.room_name) as roomName")
+                    .select("CONCAT(t3.name,\"-\" , t4.name, t.room_name) as roomName")
                     .leftJoin(RoomBed.class, RoomBed::getRoomId, Room::getId)
                     .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, RoomBed::getStudentUserId)
                     .leftJoin(BaseOfficeBuild.class, BaseOfficeBuild::getId, Room::getOfficeBuildId)
@@ -235,6 +236,7 @@ public class RoomBedCheckRecordServiceImpl extends MPJBaseServiceImpl<RoomBedChe
         //根据宿管任命
         MPJLambdaWrapper<Room> queryRoomByTeacherAppoint = new MPJLambdaWrapper<>();
         queryRoomByTeacherAppoint
+                .distinct()
                 .selectAs(Room::getId, RoomEchoVo::getRoomId)
                 .select("CONCAT(t2.name,\"-\" , t3.name, t.room_name) as roomName")
                 .leftJoin(RoomTeacherAppoint.class, RoomTeacherAppoint::getRoomId, Room::getId)

+ 4 - 0
src/main/java/com/xjrsoft/module/textbook/controller/TextbookStudentClaimController.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.textbook.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -18,6 +19,7 @@ import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -145,6 +147,8 @@ public class TextbookStudentClaimController {
             textbookStudentClaim.setId(dto.getTextbookStudentClaimId());
             textbookStudentClaim.setIsClaim(1);
             textbookStudentClaim.setRemark(dto.getRemark());
+            textbookStudentClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
+            textbookStudentClaim.setModifyDate(new Date());
             textbookStudentClaimService.updateById(textbookStudentClaim);
         }
         return RT.ok(true);

+ 8 - 0
src/main/java/com/xjrsoft/module/textbook/mapper/TextbookMapper.java

@@ -41,6 +41,14 @@ public interface TextbookMapper extends MPJBaseMapper<Textbook> {
      */
     List<TextbookSubscriptionRecordVo> subscriptionList(Long id);
 
+    /**
+     * 作业本征订记录
+     *
+     * @param id
+     * @return
+     */
+    List<TextbookSubscriptionRecordVo> exerciseBookSubscriptionList(Long id);
+
 
     /**
      * 查询征订记录中的使用班级

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

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
@@ -31,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -61,19 +63,20 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean add(Textbook textbook) {
+        textbook.setCreateDate(new Date());
         textbookTextbookMapper.insert(textbook);
         for (TextbookClassRelation textbookClassRelation : textbook.getTextbookClassRelationList()) {
             textbookClassRelation.setTextbookId(textbook.getId());
+            textbookClassRelation.setCreateDate(new Date());
             textbookTextbookClassRelationMapper.insert(textbookClassRelation);
         }
         if (textbook.getTextbookSubscriptionRecordList() != null) {
             for (TextbookSubscriptionRecord textbookSubscriptionRecord : textbook.getTextbookSubscriptionRecordList()) {
-                textbookSubscriptionRecord.setWfTextbookSubscriptionId(textbook.getId());
+                textbookSubscriptionRecord.setTextbookId(textbook.getId());
+                textbookSubscriptionRecord.setCreateDate(new Date());
                 textbookTextbookSubscriptionRecordMapper.insert(textbookSubscriptionRecord);
             }
         }
-
-
         return true;
     }
 
@@ -195,23 +198,28 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                 //征订的教材没有在教材管理
                 if (ObjectUtil.isNull(textbookList) || textbookList.size() == 0) {
                     Textbook textbook = new Textbook() {{
-                        setIssn(wfTextbookSubscriptionItem.getIssn());
-                        setIsbn(wfTextbookSubscriptionItem.getIsbn());
-                        setBookName(wfTextbookSubscriptionItem.getBookName());
-                        setPublishingHouse(wfTextbookSubscriptionItem.getPublishingHouse());
-                        setEditorInChief(wfTextbookSubscriptionItem.getEditorInChief());
-                        setSubjectGroupId(wfTextbookSubscription.getSubjectGroupId());
+                        setIssn((ObjectUtil.isNull(wfTextbookSubscriptionItem.getIssn()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getIssn())) ? "/" : wfTextbookSubscriptionItem.getIssn());
+                        setIsbn((ObjectUtil.isNull(wfTextbookSubscriptionItem.getIsbn()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getIsbn())) ? "/" : wfTextbookSubscriptionItem.getIsbn());
+                        setBookName((ObjectUtil.isNull(wfTextbookSubscriptionItem.getBookName()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getBookName())) ? "/" : wfTextbookSubscriptionItem.getBookName());
+                        setPublishingHouse((ObjectUtil.isNull(wfTextbookSubscriptionItem.getPublishingHouse()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getPublishingHouse())) ? "/" : wfTextbookSubscriptionItem.getPublishingHouse());
+                        setEditorInChief((ObjectUtil.isNull(wfTextbookSubscriptionItem.getEditorInChief()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getEditorInChief())) ? "/" : wfTextbookSubscriptionItem.getEditorInChief());
+                        setSubjectGroupId((ObjectUtil.isNull(wfTextbookSubscription.getSubjectGroupId())) ? 0 : wfTextbookSubscription.getSubjectGroupId());
                         setBaseSemesterId(wfTextbookSubscription.getBaseSemesterId());
-                        setCourseSubjectId(wfTextbookSubscriptionItem.getCourseSubjectId());
-                        setVersion(wfTextbookSubscriptionItem.getVersion());
-                        setIsTextbookPlan(wfTextbookSubscriptionItem.getIsTextbookPlan());
+                        setCourseSubjectId((ObjectUtil.isNull(wfTextbookSubscriptionItem.getCourseSubjectId())) ? 0 : wfTextbookSubscriptionItem.getCourseSubjectId());
+                        setVersion((ObjectUtil.isNull(wfTextbookSubscriptionItem.getVersion()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getVersion())) ? "/" : wfTextbookSubscriptionItem.getVersion());
+                        setIsTextbookPlan((ObjectUtil.isNull(wfTextbookSubscriptionItem.getIsTextbookPlan()) || StringUtils.isBlank(wfTextbookSubscriptionItem.getIsTextbookPlan())) ? "/" : wfTextbookSubscriptionItem.getIsTextbookPlan());
                         if (ObjectUtil.isNotNull(wfTextbookSubscriptionItem.getSubscriptionType()) && wfTextbookSubscriptionItem.getSubscriptionType().equals(SubscriptionTypeEnum.STextbook.getCode())) {
                             setTextbookType(TextbookTypeEnum.TTextbook.getCode());
                         }
                         if (ObjectUtil.isNotNull(wfTextbookSubscriptionItem.getSubscriptionType()) && wfTextbookSubscriptionItem.getSubscriptionType().equals(SubscriptionTypeEnum.SMaterials.getCode())) {
                             setTextbookType(TextbookTypeEnum.TMaterials.getCode());
                         }
-                        setAppraisalPrice(wfTextbookSubscriptionItem.getAppraisalPrice());
+                        setSpecificationsModels("/");
+                        setAppraisalPrice((ObjectUtil.isNull(wfTextbookSubscriptionItem.getAppraisalPrice())) ? new BigDecimal(0) : wfTextbookSubscriptionItem.getAppraisalPrice());
+                        setPrice(new BigDecimal(0));
+                        setDiscount(10D);
+                        setSubtotal(new BigDecimal(0));
+                        setStock(0);
                     }};
 
                     //班级不为空
@@ -234,14 +242,16 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                         List<BaseClass> baseClassList = baseClassService.list(queryWrapper1);
                         if (ObjectUtil.isNotNull(baseClassList) && baseClassList.size() == 1) {
                             textbook.setGradeId(baseClassList.get(0).getGradeId());
-                        }}
-
+                        }
+                    }
                         //插入教材数据
+                        textbook.setCreateDate(new Date());
                         textbookTextbookMapper.insert(textbook);
 
                         //插入班级和教材关系
                         for (Long classId : classIdList) {
                             textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
+                                setCreateDate(new Date());
                                 setTextbookId(textbook.getId());
                                 setClassId(classId);
                             }});
@@ -249,8 +259,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
                     //添加教材征订记录
                     textbookTextbookSubscriptionRecordMapper.insert(new TextbookSubscriptionRecord() {{
+                        setCreateDate(new Date());
                         setTextbookId(textbook.getId());
-                        setWfTextbookSubscriptionId(wfTextbookSubscriptionItem.getId());//该字段存入正定项的id,征订项中有所属征订记录
+                        setWfTextbookSubscriptionId(wfTextbookSubscription.getId());//该字段存入征订项的id,征订项中有所属征订记录
                     }});
                 } else {
 
@@ -264,6 +275,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                         String[] classIdStrs = classIds.split(",");
                         for (String classIdStr : classIdStrs) {
                             textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
+                                setCreateDate(new Date());
                                 setTextbookId(textbook.getId());
                                 setClassId(Long.parseLong(classIdStr));
                             }});
@@ -271,8 +283,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     }
                     //添加教材征订记录
                     textbookTextbookSubscriptionRecordMapper.insert(new TextbookSubscriptionRecord() {{
+                        setCreateDate(new Date());
                         setTextbookId(textbook.getId());
-                        setWfTextbookSubscriptionId(wfTextbookSubscriptionItem.getId());//该字段存入正定项的id,征订项中有所属征订记录
+                        setWfTextbookSubscriptionId(wfTextbookSubscription.getId());//该字段存入正定项的id,征订项中有所属征订记录
                     }});
                 }
             }
@@ -302,15 +315,21 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                 //征订的作业本没有在教材管理
                 if (ObjectUtil.isNull(textbookList) || textbookList.size() == 0) {
                     Textbook textbook = new Textbook() {{
-                        setBaseSemesterId(wfExerciseBook.getBaseSemesterId());
+                        setIssn("/");
+                        setIsbn("/");
                         if(ObjectUtil.isNotNull(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook1.getCode())){
                             setBookName(ExerciseBookeTypeEnum.ExerciseBook1.getValue());
                         }
                         if(ObjectUtil.isNotNull(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook2.getCode())){
                             setBookName(ExerciseBookeTypeEnum.ExerciseBook2.getValue());
                         }
-                        setSpecificationsModels(wfExerciseBookItem.getSpecificationsModels());
+                        setPublishingHouse("/");
+                        setEditorInChief("/");
+                        setBaseSemesterId(wfExerciseBook.getBaseSemesterId());
+                        setVersion("/");
+                        setIsTextbookPlan("/");
                         setTextbookType(TextbookTypeEnum.TExerciseBook.getCode());
+                        setSpecificationsModels((ObjectUtil.isNull(wfExerciseBookItem.getSpecificationsModels()) || StringUtils.isBlank(wfExerciseBookItem.getSpecificationsModels())) ? "/" : wfExerciseBookItem.getSpecificationsModels());
                         //年级id
                         if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0){
                             LambdaQueryWrapper<BaseClass> queryWrapper1 = new LambdaQueryWrapper<>();
@@ -321,15 +340,21 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                                 setGradeId(baseClass.getGradeId());
                             }
                         }
-                        setAppraisalPrice(wfExerciseBookItem.getAppraisalPrice());
+                        setAppraisalPrice((ObjectUtil.isNull(wfExerciseBookItem.getAppraisalPrice())) ? new BigDecimal(0) : wfExerciseBookItem.getAppraisalPrice());
+                        setPrice(new BigDecimal(0));
+                        setDiscount(10D);
+                        setSubtotal(new BigDecimal(0));
+                        setStock(0);
                     }};
 
                     //插入教材数据
+                    textbook.setCreateDate(new Date());
                     textbookTextbookMapper.insert(textbook);
 
                     //插入班级和教材关系
                     if(ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0){
                         textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
+                            setCreateDate(new Date());
                             setTextbookId(textbook.getId());
                             setClassId(wfExerciseBook.getClassId());
                         }});
@@ -338,8 +363,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
                     //添加教材征订记录
                     textbookTextbookSubscriptionRecordMapper.insert(new TextbookSubscriptionRecord() {{
+                        setCreateDate(new Date());
                         setTextbookId(textbook.getId());
-                        setWfTextbookSubscriptionId(wfExerciseBookItem.getId());
+                        setWfTextbookSubscriptionId(wfExerciseBook.getId());
                     }});
                 } else {
                     //征订的教材在教材管理,进行班级的和记录的管理
@@ -348,6 +374,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     //班级不为空
                     if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0) {
                         textbookTextbookClassRelationMapper.insert(new TextbookClassRelation() {{
+                            setCreateDate(new Date());
                             setTextbookId(textbook.getId());
                             setClassId(wfExerciseBook.getClassId());
                         }});
@@ -355,8 +382,9 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                     }
                     //添加教材征订记录
                     textbookTextbookSubscriptionRecordMapper.insert(new TextbookSubscriptionRecord() {{
+                        setCreateDate(new Date());
                         setTextbookId(textbook.getId());
-                        setWfTextbookSubscriptionId(wfExerciseBookItem.getId());
+                        setWfTextbookSubscriptionId(wfExerciseBook.getId());
                     }});
                 }
             }
@@ -366,31 +394,51 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
 
     @Override
     public List<TextbookSubscriptionRecordVo> subscriptionList(Long id) {
-        List<TextbookSubscriptionRecordVo> recordVos = textbookTextbookMapper.subscriptionList(id);
-        for (TextbookSubscriptionRecordVo recordVo : recordVos) {
-            if (ObjectUtil.isNull(recordVo) || StrUtil.isEmpty(recordVo.getClassIds())) {
-                recordVos.remove(recordVo);
-                if(recordVos.isEmpty()){
-                    break;
-                }
-                continue;
-            }
-            String[] split = recordVo.getClassIds().split(",");
-            List<String> ids = new ArrayList<>();
-            for (String classId : split) {
-                ids.add(classId.trim());
+        Textbook textbook = this.getById(id);
+        List<TextbookSubscriptionRecordVo> recordVos = new ArrayList<>();
+        //是作业本
+        if(textbook.getTextbookType().equals(TextbookTypeEnum.TExerciseBook.getCode())){
+            recordVos = textbookTextbookMapper.exerciseBookSubscriptionList(id);
+            for (TextbookSubscriptionRecordVo recordVo : recordVos) {
+                recordVo.setIssn("/");
+                recordVo.setPublishingHouse("/");
+                recordVo.setEditorInChief("/");
+                recordVo.setIsTextbookPlanCn("/");
+                recordVo.setCourseName("/");
+                recordVo.setGradeName("/");
+                recordVo.setTeacherSubscriptionNumber(0);
+                recordVo.setTeacherFeferenceNumber(0);
             }
-            List<TextbookSubscriptionClassVo> classInfo = textbookTextbookMapper.getClassInfo(ids);
-            String useClass = "";
-            for (int i = 0; i < classInfo.size(); i++) {
-                if (i >= 1) {
-                    useClass += ",";
+        }
+        //是教材或者教辅
+        if (textbook.getTextbookType().equals(TextbookTypeEnum.TTextbook.getCode()) || textbook.getTextbookType().equals(TextbookTypeEnum.TMaterials.getCode())){
+            recordVos = textbookTextbookMapper.subscriptionList(id);
+            for (TextbookSubscriptionRecordVo recordVo : recordVos) {
+                if (ObjectUtil.isNull(recordVo) || StrUtil.isEmpty(recordVo.getClassIds())) {
+                    recordVos.remove(recordVo);
+                    if(recordVos.isEmpty()){
+                        break;
+                    }
+                    continue;
+                }
+                String[] split = recordVo.getClassIds().split(",");
+                List<String> ids = new ArrayList<>();
+                for (String classId : split) {
+                    ids.add(classId.trim());
+                }
+                List<TextbookSubscriptionClassVo> classInfo = textbookTextbookMapper.getClassInfo(ids);
+                String useClass = "";
+                for (int i = 0; i < classInfo.size(); i++) {
+                    if (i >= 1) {
+                        useClass += ",";
+                    }
+                    TextbookSubscriptionClassVo classVo = classInfo.get(i);
+                    useClass += classVo.getName();
                 }
-                TextbookSubscriptionClassVo classVo = classInfo.get(i);
-                useClass += classVo.getName();
+                recordVo.setUseClass(useClass);
             }
-            recordVo.setUseClass(useClass);
         }
+
         return recordVos;
     }
 
@@ -444,27 +492,30 @@ 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));
         //更新总的库存数量
-        Textbook updateTextbook = new Textbook();
-        updateTextbook.setId(textbook.getId());
-        Integer oldStock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
-        updateTextbook.setStock(oldStock + (ObjectUtil.isNull(dto.getWarehouseNumber()) ? 0 : dto.getWarehouseNumber()));
-        BigDecimal price = ObjectUtil.isNull(dto.getPrice())?new BigDecimal(0):dto.getPrice();
-        updateTextbook.setPrice(price);
-        Double discount = ObjectUtil.isNull(dto.getDiscount())?10:dto.getDiscount();
-        updateTextbook.setDiscount(discount);
-        BigDecimal subtotal = price.multiply(new BigDecimal(discount/10));
-        updateTextbook.setSubtotal(subtotal);
-
-        boolean isSuccess = this.updateById(updateTextbook);
+        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);
+                setModifyDate(new Date());
+            }
+        });
 
         TextbookWarehouseRecord textbookWarehouseRecord = BeanUtil.toBean(dto, TextbookWarehouseRecord.class);
         textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
         textbookWarehouseRecord.setDiscount(discount);
         textbookWarehouseRecord.setSubtotal(subtotal);
-        isSuccess = textbookClassWarehouseService.save(textbookWarehouseRecord);
+        textbookWarehouseRecord.setCreateDate(new Date());
+        textbookClassWarehouseService.save(textbookWarehouseRecord);
 
-        return isSuccess;
+        return true;
     }
 
 

+ 14 - 2
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookStudentClaimServiceImpl.java

@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -86,6 +87,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
         //获取当前学生领取记录的所有学期
         MPJLambdaWrapper<TextbookStudentClaim> qwerySemester = new MPJLambdaWrapper<>();
         qwerySemester
+                .distinct()
                 .disableSubLogicDel()
                 .selectAs(BaseSemester::getName, TextbookStudentSemesterVo::getBaseSemesterIdCN)
                 .select(TextbookStudentClaim.class, x -> VoToColumnUtil.fieldsToColumns(TextbookStudentSemesterVo.class).contains(x.getProperty()))
@@ -126,13 +128,21 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
         //为每本书添加数据
         for (TeacherCheckByclassVo t : teacherCheckByclassVoList.getRecords()) {
             MPJLambdaWrapper<WfTextbookClaim> qweryActualReceivedNum = new MPJLambdaWrapper<>();
-            qweryActualReceivedNum.disableSubLogicDel().selectSum(WfTextbookClaimItem::getIssueNumber, TeacherCheckByclassVo::getActualReceivedNum).leftJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId).eq(WfTextbookClaim::getClassId, t.getClassId()).eq(WfTextbookClaimItem::getTextbookId, t.getTextbookId());
+            qweryActualReceivedNum
+                    .disableSubLogicDel()
+                    .selectAs(WfTextbookClaimItem::getIssueNumber, TeacherCheckByclassVo::getActualReceivedNum)
+                    .leftJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
+                    .eq(WfTextbookClaim::getClassId, t.getClassId())
+                    .eq(WfTextbookClaimItem::getTextbookId, t.getTextbookId());
             TeacherCheckByclassVo teacherCheckByclassVo = wfTextbookClaimMapper.selectJoinOne(TeacherCheckByclassVo.class, qweryActualReceivedNum);
 
             t.setActualReceivedNum(teacherCheckByclassVo.getActualReceivedNum());
 
             LambdaQueryWrapper<TextbookStudentClaim> queryActualClaimNum = new LambdaQueryWrapper<>();
-            queryActualClaimNum.eq(TextbookStudentClaim::getClassId, t.getClassId()).eq(TextbookStudentClaim::getTextbookId, t.getTextbookId());
+            queryActualClaimNum
+                    .eq(TextbookStudentClaim::getClassId, t.getClassId())
+                    .eq(TextbookStudentClaim::getTextbookId, t.getTextbookId())
+                    .eq(TextbookStudentClaim::getIsClaim, 1);
             Long actualClaimNum = this.count(queryActualClaimNum);
             t.setActualClaimNum(actualClaimNum);
         }
@@ -173,6 +183,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
     public Boolean updateByIds(List<Long> textbookStudentClaimIds) {
         for (Long textbookStudentClaimId : textbookStudentClaimIds) {
             this.updateById(new TextbookStudentClaim() {{
+                setModifyUserId(StpUtil.getLoginIdAsLong());
+                setModifyDate(new Date());
                 setId(textbookStudentClaimId);
                 setIsClaim(1);
             }});

+ 16 - 5
src/main/java/com/xjrsoft/module/textbook/service/impl/WfTextbookClaimServiceImpl.java

@@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -68,7 +69,6 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
             wfTextbookClaimItem.setWfTextbookClaimId(wfTextbookClaim.getId());
             wfTextbookClaimWfTextbookClaimItemMapper.insert(wfTextbookClaimItem);
         }
-
         return true;
     }
 
@@ -220,7 +220,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 throw new MyException(textbook.getBookName() + "发放总数量超出申领数量");
             }
 
-            //判断总发放数量是否超出该申请的申请数
+            //判断发放量是否多余库存
             Integer stock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
             if (stock < confirmNumber) {
                 throw new MyException(textbook.getBookName() + "库存不足");
@@ -228,8 +228,9 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
 
             //增加出库记录
             textbookIssueRecordService.save(new TextbookIssueRecord() {{
+                setCreateDate(new Date());
                 setTextbookId(wfTextbookClaimItem.getTextbookId());
-                setDataItemId(wfTextbookClaim.getId());
+                setDataId(wfTextbookClaim.getId());
                 setDataItemId(wfTextbookClaimItem.getId());
                 setIssueNumber(confirmNumber);
                 setRemainingNumber(applicantNumber - issueNumber - confirmNumber);
@@ -246,12 +247,16 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
 
             //更新教材管理中的库存数量
             textbookService.updateById(new Textbook() {{
+                setModifyUserId(StpUtil.getLoginIdAsLong());
+                setModifyDate(new Date());
                 setId(textbook.getId());
                 setStock(stock - confirmNumber);
             }});
 
             //更新申领项中的已经发放数量
             wfTextbookClaimWfTextbookClaimItemMapper.updateById(new WfTextbookClaimItem() {{
+                setModifyUserId(StpUtil.getLoginIdAsLong());
+                setModifyDate(new Date());
                 setId(wfTextbookClaimItem.getId());
                 setIssueNumber(issueNumber + confirmNumber);
             }});
@@ -265,16 +270,18 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 if (ObjectUtil.isNull(userIdList) && userIdList.size() == 0) {
                     throw new MyException("申领班级有误,请核实");
                 }
-
+                //验证当前领取教材是否已经生成领取记录
                 LambdaQueryWrapper<TextbookStudentClaim> queryWrapperRecord = new LambdaQueryWrapper<>();
                 queryWrapperRecord
                         .eq(TextbookStudentClaim::getTextbookId, wfTextbookClaimItem.getTextbookId())
-                        .eq(TextbookStudentClaim::getStudentUserId, wfTextbookClaim.getClassId());
+                        .eq(TextbookStudentClaim::getClassId, wfTextbookClaim.getClassId());
                 Long count = textbookStudentClaimService.count(queryWrapperRecord);
                 //为0的时候表示该班级该书没有生成领取记录
                 if(count <= 0){
                     for (Long userId : userIdList) {
                         textbookStudentClaimService.save(new TextbookStudentClaim() {{
+                            setCreateUserId(StpUtil.getLoginIdAsLong());
+                            setCreateDate(new Date());
                             setStudentUserId(userId);
                             setBaseSemesterId(wfTextbookClaim.getBaseSemesterId());
                             setClassId(wfTextbookClaim.getClassId());
@@ -295,7 +302,9 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 && ObjectUtil.isNotNull(wfTextbookClaim.getClaimType())) {
             //所有需要添加的可领取人ID
             List<TextbookClaimUser> textbookClaimUserList = new ArrayList<>();
+            //申领人自己可以领取
             textbookClaimUserList.add(new TextbookClaimUser() {{
+                setCreateDate(new Date());
                 setWfTextbookClaimId(wfTextbookClaim.getId());
                 setUserId(wfTextbookClaim.getApplicantUserId());
                 setUserType(2);
@@ -303,6 +312,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
             //申领类型是学生申领,学生代表可领取
             if (wfTextbookClaim.getClaimType().equals(ClaimTypeEnum.ClaimStudent.getCode())) {
                 textbookClaimUserList.add(new TextbookClaimUser() {{
+                    setCreateDate(new Date());
                     setWfTextbookClaimId(wfTextbookClaim.getId());
                     setUserId(wfTextbookClaim.getStudentUserId());
                     setUserType(1);
@@ -314,6 +324,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                     && ObjectUtil.isNotNull(wfTextbookClaim.getClaimUserId())
                     && !wfTextbookClaim.getApplicantUserId().equals(wfTextbookClaim.getClaimUserId())) {
                 textbookClaimUserList.add(new TextbookClaimUser() {{
+                    setCreateDate(new Date());
                     setWfTextbookClaimId(wfTextbookClaim.getId());
                     setUserId(wfTextbookClaim.getClaimUserId());
                     setUserType(2);

+ 14 - 4
src/main/java/com/xjrsoft/module/textbook/vo/TextbookSubscriptionRecordVo.java

@@ -90,12 +90,22 @@ public class TextbookSubscriptionRecordVo {
     private String courseName;
 
     /**
-     * 学科组名称
+     * 学科组管理编号(subject_group)
+     */
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private Long subjectGroupId;
+    /**
+     * 学科组管理编号(subject_group)
+     */
+    @ApiModelProperty("学科组管理编号(subject_group)")
+    private String subjectGroupIdCN;
+    /**
+     * 使用年级
      */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学科组名称")
-    @ApiModelProperty("学科组名称")
-    private String groupName;
+    @ExcelProperty("使用年级")
+    @ApiModelProperty("使用年级")
+    private String gradeName;
 
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("有无配套教学资源")

+ 15 - 12
src/main/resources/mapper/room/RoomStudentAppointMapper.xml

@@ -5,22 +5,25 @@
 <mapper namespace="com.xjrsoft.module.room.mapper.RoomStudentAppointMapper">
     <select id="getPage" parameterType="com.xjrsoft.module.room.dto.RoomStudentAppointPageDto" resultType="com.xjrsoft.module.room.vo.HeadTeaRoomCadreAppointPageVo">
         select
-        t2.room_id as roomId,
-        t3.room_name as roomName,
+        t.id as roomId,
         t4.name as genderCn,
-        t3.is_max as isMax
-        from base_class t
-        left join base_student_school_roll t1 on t1.class_id = t.id
-        inner join room_bed t2 on t2.student_user_id = t1.user_id
-        left join room t3 on t3.id = t2.room_id
-        left join xjr_dictionary_detail t4 on t4.code = t3.gender
-        where t1.delete_mark = 0 and t2.delete_mark = 0 and t.teacher_id = #{dto.teacherId}
+        t.room_name as roomName,
+        t.is_max as isMax
+        from room t
+        left join room_bed t1 on t1.room_id = t.id
+        left join base_student_school_roll t2 on t2.user_id = t1.student_user_id
+        left join base_class t3 on t3.id = t2.class_id
+        left join xjr_dictionary_detail t4 on t4.code = t.gender
+        where t.delete_mark = 0
+        and t1.delete_mark = 0
+        and t2.delete_mark = 0
+        and t3.teacher_id = #{dto.teacherId}
         <if test="dto.gender != null and dto.gender != ''">
-            and t3.gender = #{dto.gender}
+            and t.gender = #{dto.gender}
         </if>
         <if test="dto.roomId != null and dto.roomId > 0">
-            and t3.id = #{dto.roomId}
+            and t.id = #{dto.roomId}
         </if>
-        group by t2.room_id,t4.name
+        group by t.id,t4.name
     </select>
 </mapper>

+ 27 - 1
src/main/resources/mapper/textbook/TextbookMapper.xml

@@ -65,7 +65,12 @@
                t3.teacher_reference_number,
                t7.name AS is_support_resources_cn,
                t3.version,
-               t3.class_ids
+               t3.class_ids,
+               t3.student_subscription_number,
+               t3.teacher_subscription_number,
+               t3.teacher_reference_number,
+               t9.name as gradeName,
+               t10.group_name as subjectGroupIdCN
         FROM textbook_subscription_record t1
                  LEFT JOIN wf_textbook_subscription t2 ON t1.wf_textbook_subscription_id = t2.id
                  LEFT JOIN wf_textbook_subscription_item t3 ON t3.wf_textbook_subscription_id = t2.id
@@ -75,6 +80,27 @@
                  LEFT JOIN base_course_subject t6 ON t3.course_subject_id = t6.id
                  LEFT JOIN xjr_dictionary_detail t7
                            ON t3.is_support_resources = t7.code AND t7.item_id = 1737360269850038273
+                 LEFT JOIN textbook t8 ON t8.id = t1.textbook_id
+                 LEFT JOIN base_grade t9 ON t9.id = t8.grade_id
+                 LEFT JOIN subject_group t10 ON t10.id = t2.subject_group_id
+        WHERE t1.delete_mark = 0
+          AND t1.textbook_id = #{id}
+    </select>
+
+    <select id="exerciseBookSubscriptionList" resultType="com.xjrsoft.module.textbook.vo.TextbookSubscriptionRecordVo">
+        SELECT t2.create_date,
+               t4.name AS applicant_user,
+               t5.book_name,
+               t3.specifications_models,
+               t6.name as useClass,
+               t3.appraisal_price,
+               t3.subscription_number as studentSubscriptionNumber
+        FROM textbook_subscription_record t1
+                 LEFT JOIN wf_exercise_book t2 ON t1.wf_textbook_subscription_id = t2.id
+                 LEFT JOIN wf_exercise_book_item t3 ON t3.wf_exercise_book_id = t2.id
+                 LEFT JOIN xjr_user t4 ON t2.applicant_user_id = t4.id
+                 LEFT JOIN textbook t5 ON t5.id = t1.textbook_id
+                 LEFT JOIN base_class t6 ON t6.id = t2.class_id
         WHERE t1.delete_mark = 0
           AND t1.textbook_id = #{id}
     </select>

+ 1 - 1
src/main/resources/mapper/textbook/TextbookStudentClaimMapper.xml

@@ -6,7 +6,7 @@
     <select id="getTextbookClaimList" parameterType="com.xjrsoft.module.textbook.dto.TextbookClaimStudentConfirmDto"
             resultType="com.xjrsoft.module.textbook.vo.TextbookClaimVO">
         SELECT t.id                   AS textbookStudentClaimId,
-        t1.price * t1.discount AS discountPrice,
+        t1.price * t1.discount/10 AS discountPrice,
         t.sort_code as sortCode,
         t.textbook_id as textbookId,
         t.is_claim as isClaim,

+ 1 - 1
src/main/resources/mapper/textbook/WfTextbookClaimMapper.xml

@@ -23,7 +23,7 @@
                  LEFT JOIN textbook_claim_user t6 ON (t6.wf_textbook_claim_id = t.id)
                  LEFT JOIN xjr_user t7 ON (t7.id = t6.user_id)
         WHERE t.delete_mark = 0 and t6.user_id = #{dto.userId}
-        order by t.id;
+        order by t.create_date desc;
     </select>
 
     <select id="infoDistribute" parameterType="java.lang.Long"

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

@@ -18,7 +18,7 @@ class TextbookServiceImplTest {
 
     @Test
     void dataHandleAddTextbookNode() {
-        textbookService.dataHandleAddTextbookNode(1742828225583706112L);
+        textbookService.dataHandleAddTextbookNode(1743294003445559296L);
     }
 
     @Test