Explorar el Código

通过班级id和教材id判断当前领取教材是否已经生成领取记录

phoenix hace 2 años
padre
commit
da3c09babf

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

@@ -405,7 +405,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
                 recordVo.setEditorInChief("/");
                 recordVo.setIsTextbookPlanCn("/");
                 recordVo.setCourseName("/");
-                recordVo.setGroupName("/");
+                recordVo.setGradeName("/");
                 recordVo.setTeacherSubscriptionNumber(0);
                 recordVo.setTeacherFeferenceNumber(0);
             }

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

@@ -128,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);
         }

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

@@ -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() + "库存不足");
@@ -270,11 +270,11 @@ 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){

+ 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("有无配套教学资源")

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

@@ -68,7 +68,9 @@
                t3.class_ids,
                t3.student_subscription_number,
                t3.teacher_subscription_number,
-               t3.teacher_reference_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
@@ -78,6 +80,9 @@
                  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>