Ver código fonte

家庭经济困难认定审批流

yzx 5 meses atrás
pai
commit
2fcaf8beda

+ 0 - 2
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/task/asProcessInstanceController.java

@@ -109,6 +109,4 @@ public class asProcessInstanceController {
                 processDefinition, processDefinitionInfo, bpmnXml, startUser, dept));
     }
 
-
-
 }

+ 20 - 61
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/task/asTaskController.java

@@ -87,7 +87,27 @@ public class asTaskController {
         return success(classNameMap);
     }
 
+    @GetMapping("/done-page-aiding")
+    @Operation(summary = "获取 Done 家庭经济困难认定审批已办任务分页")
+    @PreAuthorize("@ss.hasPermission('eve:task:query')")
+    public CommonResult<Map<String,List<AidingStudentPersonManageInfoPageReqVO>>> getTaskDonePageComprehensive(@Valid BpmTaskPageReqVO pageVO) {
+        List<HistoricTaskInstance> pageResult = taskService.getTaskDonePageComprehensive(getLoginUserId(), pageVO);
+        if (CollUtil.isEmpty(pageResult)) {
+            return success(null);
+        }
+
+        //根据当前任务的idList获取 ,返回关于项目与班级分组的学生材料
+        List<AidingStudentsPersonManageDO> aidingStudentsPersonList =
+                aidingStudentsPersonManageService.getAidingStudentsPersonManageClassPage(
+                        convertList(pageResult,HistoricTaskInstance::getProcessInstanceId),pageVO
+                );
 
+        Map<String, List<AidingStudentPersonManageInfoPageReqVO>> classNameMap =
+                BeanUtils.toBean(aidingStudentsPersonList, AidingStudentPersonManageInfoPageReqVO.class).stream()
+                        .collect(Collectors.groupingBy(AidingStudentPersonManageInfoPageReqVO::getClassName));
+
+        return success(classNameMap);
+    }
     @GetMapping("/list-by-process-instance-id")
     @Operation(summary = "获得指定流程实例的任务列表", description = "包括完成的、未完成的")
     @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true)
@@ -114,67 +134,6 @@ public class asTaskController {
                 formMap, userMap, deptMap));
     }
 
-
-    @GetMapping("/done-page-aiding")
-    @Operation(summary = "获取 Done 家庭经济困难认定审批已办任务分页")
-    @PreAuthorize("@ss.hasPermission('eve:task:query')")
-    public CommonResult<Map<String,List<AidingStudentPersonManageInfoPageReqVO>>> getTaskDonePageComprehensive(@Valid BpmTaskPageReqVO pageVO) {
-        List<HistoricTaskInstance> pageResult = taskService.getTaskDonePageComprehensive(getLoginUserId(), pageVO);
-        if (CollUtil.isEmpty(pageResult)) {
-            return success(null);
-        }
-
-        //根据当前任务的idList获取 ,返回关于项目与班级分组的学生材料
-        List<AidingStudentsPersonManageDO> aidingStudentsPersonList =
-                aidingStudentsPersonManageService.getAidingStudentsPersonManageClassPage(
-                        convertList(pageResult,HistoricTaskInstance::getProcessInstanceId),pageVO
-                );
-
-        Map<String, List<AidingStudentPersonManageInfoPageReqVO>> classNameMap =
-                BeanUtils.toBean(aidingStudentsPersonList, AidingStudentPersonManageInfoPageReqVO.class).stream()
-                        .collect(Collectors.groupingBy(AidingStudentPersonManageInfoPageReqVO::getClassName));
-
-        return success(classNameMap);
-    }
-
-//    @GetMapping("done-user-list")
-//    @Operation(summary = "获取 Done 综测审批已办任务个人")
-//    @PreAuthorize("@ss.hasPermission('eve:task:query')")
-//    public CommonResult<List<asTaskRespVO>>  getTaskDoneByPeople(@Valid  BpmTaskPageReqVO pageVO) {
-//
-//        Long startUserId = pageVO.getUserId();
-//        List<AidingStudentsPersonManageDO> achievementList
-//                = aidingStudentsPersonManageService.getAchievementByPeopleAndManageId(startUserId,pageVO.getManageId());
-//
-//        Map<String, AchievementDO> achievementDOMap = convertMap(achievementList,AidingStudentsPersonManageDO::getProcessInstanceId);
-//        Collection<String> processInstanceIds = convertSet(achievementList,AidingStudentsPersonManageDO::getProcessInstanceId);
-//
-//        List<HistoricTaskInstance> pageResult
-//                = taskService.getTaskDoneByPeopleAndProcessInstanceIds(getLoginUserId(), pageVO , processInstanceIds);
-//
-//        // 使用 Stream API 来处理
-//        Map<String, HistoricTaskInstance> latestTasks = pageResult.stream()
-//                .collect(Collectors.toMap(
-//                        HistoricTaskInstance::getProcessInstanceId,
-//                        task -> task,
-//                        (existingTask, newTask) -> newTask.getEndTime().after(existingTask.getEndTime()) ? newTask : existingTask
-//                ));
-//
-//        pageResult.removeIf(task -> !latestTasks.get(task.getProcessInstanceId()).equals(task));
-//
-//
-//        if (CollUtil.isEmpty(pageResult)) {
-//            return success(null);
-//        }
-//
-//        Map<String, HistoricProcessInstance> processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
-//                convertSet(pageResult, HistoricTaskInstance::getProcessInstanceId));
-//        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
-//                convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId())));
-//
-//        return success(eveTaskConvert.INSTANCE.buildTaskDoneByPeople(pageResult, processInstanceMap, userMap,achievementDOMap));
-//    }
-//
     @PutMapping("/approve")
     @Operation(summary = "通过单项家庭经济困难认定审批")
     @PreAuthorize("@ss.hasPermission('eve:task:update')")

+ 2 - 2
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentspersonmanage/AidingStudentsPersonManageDO.java

@@ -24,7 +24,7 @@ import lombok.*;
 public class AidingStudentsPersonManageDO extends BaseDO {
     // 序号
     @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    private Long id;
     //姓名
     private String nickname;
     // 困难类型
@@ -38,7 +38,7 @@ public class AidingStudentsPersonManageDO extends BaseDO {
     // 学院id
     private Long collegeId;
     // 项目ID
-    private Integer manageId;
+    private Long manageId;
     // 学院项目主键ID
     private Integer collegeManageId;
     // 班级 :计算机类2023-1班

+ 9 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageService.java

@@ -89,4 +89,13 @@ public interface AidingStudentsPersonManageService  {
      * @return
      */
     AidingStudentPersonManageInfoRespVO schoolauditAidingStudentsPersonManageData(Integer id);
+
+    /**
+     * 更新申请的状态
+     *
+     * @param id 编号
+     * @param status 结果
+     */
+    void updateAppealStatus(Long id, Integer status);
+
 }

+ 16 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageServiceImpl.java

@@ -30,6 +30,8 @@ import java.util.*;
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
 import static cn.iocoder.yudao.module.as.enums.ErrorCodeConstants.*;
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.AIDING_NOT_EXISTS;
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_LEAVE_NOT_EXISTS;
 
 /**
  * @autor WoVoM
@@ -369,4 +371,18 @@ public class AidingStudentsPersonManageServiceImpl extends ServiceImpl<AidingStu
         vo = BeanUtils.toBean(aidingStudentPersonManageEvaluationResultDO, AidingStudentPersonManageInfoRespVO.class);
         return vo;
     }
+
+    @Override
+    public void updateAppealStatus(Long id, Integer status) {
+        validateLeaveExists(id);
+        aidingStudentsPersonManageMapper.updateById(
+                new AidingStudentsPersonManageDO().setId(id).setStatus(status)
+        );
+    }
+
+    private void validateLeaveExists(Long id) {
+        if (aidingStudentsPersonManageMapper.selectById(id) == null) {
+            throw exception(AIDING_NOT_EXISTS);
+        }
+    }
 }

+ 32 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/listener/BpmAidingStatusListener.java

@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.module.as.service.aidingstudentspersonmanage.listener;
+
+import cn.iocoder.yudao.module.as.service.aidingstudentspersonmanage.AidingStudentsPersonManageService;
+import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
+import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
+import cn.iocoder.yudao.module.as.service.aidingstudentspersonmanage.AidingStudentsPersonManageServiceImpl;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * OA 请假单的结果的监听器实现类
+ *
+ * @author 芋道源码
+ */
+@Component
+public class BpmAidingStatusListener extends BpmProcessInstanceStatusEventListener {
+
+    @Resource
+    private AidingStudentsPersonManageService aidingStudentsPersonManageService;
+
+    @Override
+    protected String getProcessDefinitionKey() {
+        return AidingStudentsPersonManageServiceImpl.PROCESS_KEY;
+    }
+
+    @Override
+    protected void onEvent(BpmProcessInstanceStatusEvent event) {
+        aidingStudentsPersonManageService.updateAppealStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
+    }
+
+}

+ 4 - 0
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java

@@ -14,6 +14,10 @@ public interface ErrorCodeConstants {
     // ========== OA 流程模块 1-009-001-000 ==========
     ErrorCode OA_LEAVE_NOT_EXISTS = new ErrorCode(1_009_001_001, "请假申请不存在");
 
+    ErrorCode EVE_APPEAL_NOT_EXISTS = new ErrorCode(1_009_001_001, "综测申请不存在");
+
+    ErrorCode AIDING_NOT_EXISTS = new ErrorCode(1_009_001_001, "家庭经济困难认定不存在");
+
     // ========== 流程模型 1-009-002-000 ==========
     ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
     ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1_009_002_001, "流程模型不存在");