Parcourir la source

Merge branch 'master' of http://gogs.gisvg.com/YDM/fdy

houlai il y a 5 mois
Parent
commit
4eeed75238
10 fichiers modifiés avec 144 ajouts et 48 suppressions
  1. 2 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentspersonmanage/vo/AidingStudentPersonManageClassVO.java
  2. 6 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentspersonmanage/vo/AidingStudentPersonManageInfoRespVO.java
  3. 56 16
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/task/asTaskController.java
  4. 16 29
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/convert/task/asTaskConvert.java
  5. 0 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentspersonmanage/AidingStudentsPersonManageDO.java
  6. 14 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/mysql/aidingstudentspersonmanage/AidingStudentsPersonManageMapper.java
  7. 4 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageService.java
  8. 6 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageServiceImpl.java
  9. 14 1
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java
  10. 26 1
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java

+ 2 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentspersonmanage/vo/AidingStudentPersonManageClassVO.java

@@ -29,4 +29,6 @@ public class AidingStudentPersonManageClassVO {
     private Integer classEdit;
     // 已经通过人数
     private Integer classPass;
+
+    private String diName;
 }

+ 6 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentspersonmanage/vo/AidingStudentPersonManageInfoRespVO.java

@@ -24,6 +24,8 @@ public class AidingStudentPersonManageInfoRespVO {
      */
     // 序号(主键)
     private Long id;
+    // 用户id
+    private Long userId;
     // 专业
     private String major;
     // 年级
@@ -64,6 +66,10 @@ public class AidingStudentPersonManageInfoRespVO {
     private Integer schoolSuggestionDifficultType;
     // 流程
     private String processInstanceId;
+
+    // 项目ID
+    private String diName;
+
     /**
      * 学生(上传材料)
      */

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

@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
 import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.security.core.LoginUser;
 import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentspersonmanage.vo.AidingStudentPersonManageClassVO;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentspersonmanage.vo.AidingStudentPersonManageInfoPageReqVO;
@@ -66,34 +67,73 @@ public class asTaskController {
     private AidingStudentsPersonManageService aidingStudentsPersonManageService;
     @Resource
     private AidingStudentsManageService aidingStudentsManageService;
+
     @GetMapping("/todo-page-aiding")
-    @Operation(summary = "获取 Todo 家庭经济困难认定审批待办任务分页")
+    @Operation(summary = "获取 Todo 家庭经济困难认定审批资助助理初审任务")
     @PreAuthorize("@ss.hasPermission('eve:task:query')")
     public CommonResult<List<AidingStudentPersonManageClassVO>> getTaskTodoPageAiding(
             @Valid BpmTaskPageReqVO pageVO) {
-        //获取我的任务中家困任务的列表
-        List<Task> ListResult = taskService.getTaskTodoPageAidingList(getLoginUserId(), pageVO);
+        AdminUserRespDTO user = adminUserApi.getUser(getLoginUserId());
+        Long collegeId = deptApi.getCollegeId(user.getDeptId());
+        Set<Long> deptIds = new HashSet<>();
+        deptIds.add(collegeId);
+
+        //获取学院的所有学生信息
+        List<AdminUserRespDTO> userList = adminUserApi.getUserListByDeptIds(deptIds);
+
+        //将本学院学生提交的全部查找并分班
+        List<AidingStudentsPersonManageDO> aidingStudentsPersonList =
+                aidingStudentsPersonManageService.getAidingStudentsByUserIds(
+                        convertList(userList,AdminUserRespDTO::getId),pageVO
+                );
 
-        if (CollUtil.isEmpty(ListResult)) {
+        if (CollUtil.isEmpty(aidingStudentsPersonList)) {
             return success(null);
         }
 
-        List<AidingStudentsPersonManageDO> aidingStudentsPersonList =
-                aidingStudentsPersonManageService.selectByProcessInstanceIdsGroupByClass(
-                        convertList(ListResult,Task::getProcessInstanceId),pageVO
+        //根据提交的流程全部查找
+        List<HistoricTaskInstance> pageResult = taskService.getTaskTodoPageAidingListByProcessInstanceIds(
+                getLoginUserId(), pageVO,
+                convertList(aidingStudentsPersonList,AidingStudentsPersonManageDO::getProcessInstanceId)
         );
 
-        Map<Long, AidingStudentsManageDO> aidingStudentsManageMap =
-                aidingStudentsManageService.getAidingStudentsManageMap(convertSet(aidingStudentsPersonList
-                        , AidingStudentsPersonManageDO::getManageId));
 
-        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
-                convertSet(aidingStudentsPersonList, AidingStudentsPersonManageDO::getUserId));
-        Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
-                convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
 
-        return success(asTaskConvert.INSTANCE.buildTodoTaskPageAiding(
-                userMap,deptMap,aidingStudentsManageMap,aidingStudentsPersonList));
+//
+//        // 使用 Stream API 来处理
+//        Map<String, HistoricTaskInstance> latestTasks = pageResult.stream()
+//                .collect(Collectors.toMap(
+//                        HistoricTaskInstance::getProcessInstanceId,
+//                        task -> task,
+//                        (existingTask, newTask) -> newTask.getEndTime().after(existingTask.getEndTime()) ? newTask : existingTask
+//                ));
+//
+//        //获取我的任务中家困任务的列表
+//        List<Task> ListResult = taskService.getTaskTodoPageAidingList(getLoginUserId(), pageVO);
+
+
+//        // 进行筛选,只保留名称为“资助助理初审”的任务
+//        ListResult = ListResult.stream()
+//                .filter(t -> Objects.equals(t.getName(), "资助助理初审"))
+//                .collect(Collectors.toList());
+
+//        if (CollUtil.isEmpty(ListResult)) {
+//            return success(null);
+//        }
+
+//        List<AidingStudentsPersonManageDO> aidingStudentsPersonList =
+//                aidingStudentsPersonManageService.selectByProcessInstanceIdsGroupByClass(
+//                        convertList(ListResult,Task::getProcessInstanceId),pageVO
+//        );
+
+//        Map<Long, AidingStudentsManageDO> aidingStudentsManageMap =
+//                aidingStudentsManageService.getAidingStudentsManageMap(convertSet(aidingStudentsPersonList
+//                        , AidingStudentsPersonManageDO::getManageId));
+
+//        return success(asTaskConvert.INSTANCE.buildTodoTaskPageAiding(ListResult,
+//                aidingStudentsManageMap,aidingStudentsPersonList));
+
+        return null;
     }
 
     @GetMapping("/done-page-aiding")

+ 16 - 29
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/convert/task/asTaskConvert.java

@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.as.controller.admin.aidingstudentspersonmanage.vo.AidingStudentPersonManageInfoPageReqVO;
+import cn.iocoder.yudao.module.as.controller.admin.aidingstudentspersonmanage.vo.AidingStudentPersonManageInfoRespVO;
 import cn.iocoder.yudao.module.as.controller.admin.task.vo.task.asTaskRespVO;
 import cn.iocoder.yudao.module.as.dal.dataobject.aidingstudentsmanage.AidingStudentsManageDO;
 import cn.iocoder.yudao.module.as.dal.dataobject.aidingstudentspersonmanage.AidingStudentsPersonManageDO;
@@ -16,10 +17,8 @@ import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
 import org.mapstruct.Mapper;
 import org.mapstruct.factory.Mappers;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * Bpm 任务 Convert
@@ -31,31 +30,19 @@ public interface asTaskConvert {
 
     asTaskConvert INSTANCE = Mappers.getMapper(asTaskConvert.class);
 
-    default List<AidingStudentPersonManageClassVO>  buildTodoTaskPageAiding(Map<Long, AdminUserRespDTO> userMap,
-                                                                                  Map<Long, DeptRespDTO> deptMap,
-                                                                                  Map<Long, AidingStudentsManageDO> aidingStudentsManageMap,
-                                                                                  List<AidingStudentsPersonManageDO> aidingStudentsPersonList) {
-//        for (AidingStudentsPersonManageDO aidingStudentsPerson : aidingStudentsPersonList) {
-//            DeptRespDTO dept = deptMap.get(aidingStudentsPerson.getUserId());
-//            aidingStudentsPerson.setClassName(dept.getName());
-//             if (startUser != null) {
-//                MapUtils.findAndThen(deptMap, startUser.getDeptId(),
-//                        dept -> achievement.getStartUser().setDeptName(dept.getName())
-//                );
-//                MapUtils.findAndThen(deptMap, startUser.getDeptId(),
-//                        dept -> achievement.setReviewType(
-//                                Objects.equals(deptId, dept.getId()) ? "班级自评" : "班级互评"
-//                        )
-//                );
-//                achievement.getStartUser().setNickname(startUser.getNickname());
-//                achievement.setStudentId(startUser.getStudentId());
-//            }
-//
-//            MapUtils.findAndThen(comprehensiveManageDOMap, achievement.getManageId(),
-//                    ComprehensiveManage -> achievement.setComprehensiveManage(
-//                            BeanUtils.toBean(ComprehensiveManage,AchievementDO.ComprehensiveManage.class))
-//            );
-//        }
+    default List<AidingStudentPersonManageClassVO>  buildTodoTaskPageAiding(
+            List<Task> ListResult,
+            Map<Long, AidingStudentsManageDO> aidingStudentsManageMap,
+            List<AidingStudentsPersonManageDO> aidingStudentsPersonList
+    ) {
+        List<AidingStudentPersonManageInfoRespVO> aidingList
+                = BeanUtils.toBean(aidingStudentsPersonList, AidingStudentPersonManageInfoRespVO.class);
+        for (AidingStudentPersonManageInfoRespVO AidingStudentsPerson : aidingList) {
+
+            MapUtils.findAndThen(aidingStudentsManageMap, AidingStudentsPerson.getManageId(),
+                    aidingStudentsManage -> AidingStudentsPerson.setDiName(aidingStudentsManage.getDiName())
+            );
+        }
         return BeanUtils.toBean(aidingStudentsPersonList, AidingStudentPersonManageClassVO.class);
     }
 //

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

@@ -22,7 +22,6 @@ public class AidingStudentsPersonManageDO extends BaseDO {
     // 序号
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
-
     //用户id
     private Long userId;
     //姓名

+ 14 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/mysql/aidingstudentspersonmanage/AidingStudentsPersonManageMapper.java

@@ -56,6 +56,20 @@ public interface AidingStudentsPersonManageMapper extends BaseMapperX<AidingStud
         );
     }
 
+    default List<AidingStudentsPersonManageDO>  getAidingStudentsByUserIds(List<Long> ids,
+                                                                              BpmTaskPageReqVO pageVO){
+        return selectList(
+                new LambdaQueryWrapperX<AidingStudentsPersonManageDO>()
+                        .in(AidingStudentsPersonManageDO::getUserId,ids)
+                        .eqIfPresent(AidingStudentsPersonManageDO::getClass,pageVO.getClassId())
+                        .eqIfPresent(AidingStudentsPersonManageDO::getManageId,pageVO.getManageId())
+                        .eqIfPresent(AidingStudentsPersonManageDO::getCollegeId,pageVO.getCollegeId())
+                        .eqIfPresent(AidingStudentsPersonManageDO::getNickname,pageVO.getUsername())
+                        .in(AidingStudentsPersonManageDO::getStatus,0,1,6)
+                        .groupBy(AidingStudentsPersonManageDO::getClassName)
+        );
+    }
+
     default List<AidingStudentsPersonManageDO>  selectByProcessInstanceIdsGroupByUser(List<String> processInstanceIds,
                                                                               BpmTaskPageReqVO pageVO){
 

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

@@ -31,6 +31,10 @@ public interface AidingStudentsPersonManageService  {
             List<String> ids,BpmTaskPageReqVO pageVO
     );
 
+    List<AidingStudentsPersonManageDO>  getAidingStudentsByUserIds(
+            List<Long> ids,BpmTaskPageReqVO pageVO
+    );
+
     /**
      * 班主任上传线下讨论结果信息
      * @param classuploadVO

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

@@ -234,6 +234,12 @@ public class AidingStudentsPersonManageServiceImpl extends ServiceImpl<AidingStu
         return aidingStudentsPersonManageMapper.selectListByProcessInstanceId(ids,pageVO);
     };
 
+    @Override
+    public List<AidingStudentsPersonManageDO> getAidingStudentsByUserIds(List<Long> ids,
+                                                                                     BpmTaskPageReqVO pageVO){
+        return aidingStudentsPersonManageMapper.getAidingStudentsByUserIds(ids,pageVO);
+    };
+
     /**
      * 定序与建议等级
      * @param ids

+ 14 - 1
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java

@@ -51,6 +51,17 @@ public interface BpmTaskService {
      */
     List<Task> getTaskTodoPageAidingList(Long userId, BpmTaskPageReqVO pageReqVO);
 
+
+    /**
+     * 获得待办综测审批的流程任务分页
+     *
+     * @param userId    用户编号
+     * @param pageReqVO 分页请求
+     * @return 流程任务分页
+     */
+    List<HistoricTaskInstance> getTaskTodoPageAidingListByProcessInstanceIds(Long userId, BpmTaskPageReqVO pageReqVO,
+                                                             Collection<String> processInstanceIds);
+
     /**
      * 获得待办综测审批的流程任务分页
      *
@@ -95,7 +106,9 @@ public interface BpmTaskService {
      * @param pageReqVO 分页请求
      * @return 流程任务分页
      */
-    List<HistoricTaskInstance> getTaskDoneByPeopleAndProcessInstanceIds(Long userId, BpmTaskPageReqVO pageReqVO,Collection<String> processInstanceIds);
+    List<HistoricTaskInstance> getTaskDoneByPeopleAndProcessInstanceIds(Long userId,
+                                                                        BpmTaskPageReqVO pageReqVO,
+                                                                        Collection<String> processInstanceIds);
 
     /**
      * 获得全部的流程任务分页

+ 26 - 1
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java

@@ -144,6 +144,27 @@ public class BpmTaskServiceImpl implements BpmTaskService {
         return taskQuery.list();
     }
 
+    @Override
+    public List<HistoricTaskInstance> getTaskTodoPageAidingListByProcessInstanceIds(Long userId,
+                                                                                    BpmTaskPageReqVO pageVO,
+                                                                                    Collection<String> processInstanceIds) {
+        HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
+                .taskAssignee(String.valueOf(userId)) // 分配给自己
+                .processDefinitionKey("familyDifficulties")
+                .includeTaskLocalVariables()
+                .processInstanceIdIn(processInstanceIds)
+                .orderByHistoricTaskInstanceEndTime().desc(); // 审批时间倒序
+        if (StrUtil.isNotBlank(pageVO.getName())) {
+            taskQuery.taskNameLike("%" + pageVO.getName() + "%");
+        }
+        if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
+            taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
+            taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[1]));
+        }
+        return taskQuery.list();
+    }
+
+
     @Override
     public List<Task> getTaskTodoPageComprehensiveByPeople(Long userId, eveProcessInstanceReqVO pageVO) {
         TaskQuery taskQuery = taskService.createTaskQuery()
@@ -163,6 +184,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
         return tasks;
     }
 
+
+
     @Override
     public PageResult<HistoricTaskInstance> getTaskDonePage(Long userId, BpmTaskPageReqVO pageVO) {
         HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
@@ -223,7 +246,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
         return taskQuery.list();
     }
     @Override
-    public List<HistoricTaskInstance> getTaskDoneByPeopleAndProcessInstanceIds(Long userId, BpmTaskPageReqVO pageVO,Collection<String> processInstanceIds) {
+    public List<HistoricTaskInstance> getTaskDoneByPeopleAndProcessInstanceIds(Long userId,
+                                                                               BpmTaskPageReqVO pageVO,
+                                                                               Collection<String> processInstanceIds) {
         HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
                 .finished() // 已完成
                 .taskAssignee(String.valueOf(userId)) // 分配给自己