Kaynağa Gözat

作废教材申领

大数据与最优化研究所 7 ay önce
ebeveyn
işleme
fbe3d45cbc

+ 15 - 2
src/main/java/com/xjrsoft/module/textbook/controller/WfTextbookClaimController.java

@@ -30,6 +30,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -58,9 +59,8 @@ public class WfTextbookClaimController {
                 .distinct()
                 .selectAs(WfTextbookClaim::getBaseSemesterId, DistributeSemesterVo::getBaseSemesterId)
                 .selectAs(BaseSemester::getName, DistributeSemesterVo::getBaseSemesterIdCn)
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
                 .leftJoin(BaseSemester.class, BaseSemester::getId, WfTextbookClaim::getBaseSemesterId)
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
         ;
 
         List<DistributeSemesterVo> distributeSemesterVoList = wfTextbookClaimService.selectJoinList(DistributeSemesterVo.class, wfTextbookClaimMPJLambdaWrapper);
@@ -150,6 +150,19 @@ public class WfTextbookClaimController {
 
     }
 
+    @PostMapping("/nullify")
+    @ApiOperation(value = "作废教材申领")
+    @SaCheckPermission("wftextbookclaim:edit")
+    @XjrLog(value = "作废教材申领", saveResponseData = true)
+    public RT<Boolean> nullify(@Valid @RequestBody NullifyWfTextbookClaimDto dto) {
+        WfTextbookClaim wfTextbookClaim = new WfTextbookClaim();
+        wfTextbookClaim.setId(dto.getId());
+        wfTextbookClaim.setWorkflowStatus(2);
+        wfTextbookClaim.setModifyDate(new Date());
+        wfTextbookClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
+        return RT.ok(wfTextbookClaimService.updateById(wfTextbookClaim));
+    }
+
     @DeleteMapping
     @ApiOperation(value = "删除教材申领")
     @SaCheckPermission("wftextbookclaim:delete")

+ 13 - 0
src/main/java/com/xjrsoft/module/textbook/dto/NullifyWfTextbookClaimDto.java

@@ -0,0 +1,13 @@
+package com.xjrsoft.module.textbook.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class NullifyWfTextbookClaimDto {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("教材申领记录主键id")
+    private Long id;
+}

+ 4 - 8
src/main/java/com/xjrsoft/module/textbook/service/impl/TextbookStudentClaimServiceImpl.java

@@ -257,8 +257,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
                 .select("1 as claim_num")
                 .select("if(t.issue_number > 0, 1, 0) as is_issue")
                 .innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .innerJoin(Textbook.class, Textbook::getId, WfTextbookClaimItem::getTextbookId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
                         wrapper -> wrapper
@@ -287,8 +286,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
                 .select("1 as claim_num")
                 .select("if(t.issue_number > 0, 1, 0) as is_issue")
                 .innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .innerJoin(Textbook.class, Textbook::getId, WfTextbookClaimItem::getTextbookId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
                         wrapper -> wrapper
@@ -441,9 +439,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
                 .selectAs(BaseSemester::getName, StudentSemesterTextbookVo::getBaseSemesterIdCN)
                 .selectAs(WfTextbookClaimItem::getTextbookId, StudentSemesterTextbookVo::getTextbookId)
                 .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
                 .leftJoin(BaseSemester.class, BaseSemester::getId, WfTextbookClaim::getBaseSemesterId)
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .eq(WfTextbookClaim::getClassId, baseStudentSchoolRoll.getClassId())
                 .eq(WfTextbookClaim::getClaimType, ClaimTypeEnum.ClaimClass.getCode())
         ;
@@ -466,9 +463,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
                 .selectAs(BaseSemester::getName, StudentSemesterTextbookVo::getBaseSemesterIdCN)
                 .selectAs(WfTextbookClaimItem::getTextbookId, StudentSemesterTextbookVo::getTextbookId)
                 .innerJoin(WfTextbookClaimItem.class, WfTextbookClaimItem::getWfTextbookClaimId, WfTextbookClaim::getId)
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
                 .leftJoin(BaseSemester.class, BaseSemester::getId, WfTextbookClaim::getBaseSemesterId)
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .eq(WfTextbookClaim::getApplicantUserId, loginId)
                 .eq(WfTextbookClaim::getClaimType, ClaimTypeEnum.ClaimStudent.getCode())
         ;

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

@@ -77,7 +77,6 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 .disableSubLogicDel()
                 .select(WfTextbookClaim::getId)
                 .select(WfTextbookClaim.class, x -> VoToColumnUtil.fieldsToColumns(DistributePageVo.class).contains(x.getProperty()))
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfTextbookClaim::getClaimType,
                         wrapper -> wrapper
                                 .selectAs(DictionaryDetail::getName, DistributePageVo::getClaimTypeCn)
@@ -98,7 +97,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                         wrapper -> wrapper
                                 .selectAs(XjrUser::getName, DistributePageVo::getStudentUserIdCn)
                 )
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .eq(WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
                 .eq(StringUtils.isNotEmpty(dto.getClaimType()), WfTextbookClaim::getClaimType, dto.getClaimType())
                 .and(StringUtils.isNotEmpty(dto.getName()),
@@ -668,7 +667,6 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                 .disableSubLogicDel()
                 .select(WfTextbookClaim::getId)
                 .select(WfTextbookClaim.class, x -> VoToColumnUtil.fieldsToColumns(ClaimRecordsExportQueryVo.class).contains(x.getProperty()))
-                .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfTextbookClaim::getId)
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfTextbookClaim::getClaimType,
                         wrapper -> wrapper
                                 .selectAs(DictionaryDetail::getName, ClaimRecordsExportQueryVo::getClaimTypeCn)
@@ -685,7 +683,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
                         wrapper -> wrapper
                                 .selectAs(BaseSemester::getName, ClaimRecordsExportQueryVo::getBaseSemesterIdCn)
                 )
-                .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
+                .eq(WfTextbookClaim::getWorkflowStatus, 1)
                 .eq(ObjectUtils.isNotEmpty(dto.getBaseSemesterId()), WfTextbookClaim::getBaseSemesterId, dto.getBaseSemesterId())
         ;
         List<ClaimRecordsExportQueryVo> dataList = this.selectJoinList(ClaimRecordsExportQueryVo.class, wfTextbookClaimMPJLambdaWrapper);

+ 16 - 1
src/main/resources/sqlScript/20250421_sql.sql

@@ -1 +1,16 @@
-ALTER TABLE professional_title ADD UNIQUE (professional_title_no);
+ALTER TABLE professional_title ADD UNIQUE (professional_title_no);
+
+create index user_id_semester_id_index
+    on textbook_student_claim (student_user_id, base_semester_id)
+    comment '用户学期复合索引';
+
+create index class_id_semester_id_index
+    on textbook_student_claim (class_id, base_semester_id)
+    comment '班级学期复合索引';
+
+create index user_id_textbook_id_index
+    on textbook_student_claim (student_user_id, textbook_id)
+    comment '用户教材复合索引';
+
+# 上面已经在正式服运行-------------------------------------------------------------
+

+ 36 - 0
src/main/resources/sqlScript/教材费用视图.sql

@@ -0,0 +1,36 @@
+DROP VIEW IF EXISTS v_cse_book1;
+create view v_cse_book1 as
+(
+with all_stu as (select t.base_semester_id,
+                        t.student_user_id
+                 from textbook_student_claim t
+                 group by t.base_semester_id,
+                          t.student_user_id)
+select t1.beltcode                                              AS `beltcode`,
+       t1.beltname                                              AS `beltname`,
+       t5.speccode                                              AS `speccode`,
+       t5.specname                                              AS `specname`,
+       t6.speccode                                              AS `classcode`,
+       t6.specname                                              AS `classname`,
+       '教材费'                                                 AS `feeitemname`,
+       ifnull((select sum(a.price)
+               from textbook_student_claim a
+               where a.is_claim = 1
+                 and a.base_semester_id = t.base_semester_id
+                 and a.student_user_id = t.student_user_id), 0) AS `totalmoney`,
+       t7.credential_number                                     AS `Personalid`,
+       t7.name                                                  AS `Feeobjname`,
+       ''                                                       AS `Remarks`
+from all_stu t
+         left join pb_semester_config t1 on t1.base_semester_id = t.base_semester_id
+         left join base_student_school_roll t2 on t2.user_id = t.student_user_id
+         left join base_class t3 on t3.id = t2.class_id
+         left join base_major_set t4 on t4.id = t3.major_set_id
+         left join pb_cse_spec1 t5 on t5.specname = t4.name
+         left join pb_cse_class1 t6 on t6.specname = t3.name
+         left join xjr_user t7 on t7.id = t.student_user_id
+where t2.delete_mark = 0
+  and t3.delete_mark = 0
+  and t4.delete_mark = 0
+  and t7.delete_mark = 0
+    )