dzx 8 місяців тому
батько
коміт
634a64ae20

+ 1 - 3
src/main/java/com/xjrsoft/module/liteflow/node/StudentDropOutNode.java

@@ -109,11 +109,9 @@ public class StudentDropOutNode extends NodeComponent {
                                 2
                         );
 
-
-
                         schoolRoll.setArchivesStatus(ArchivesStatusEnum.FB2904.getCode());
                         studentSchoolRollService.updateById(schoolRoll);
-                        studentSchoolRollService.disableStudent(schoolRoll.getUserId());
+                        studentSchoolRollService.disableStudent(schoolRoll.getUserId(), studentDropOut.getCreateUserId());
                     });
                 }
             });

+ 1 - 1
src/main/java/com/xjrsoft/module/student/controller/StudentTryReadingReportController.java

@@ -350,7 +350,7 @@ public class StudentTryReadingReportController {
                         && x.getReportTime() != null
         ).count());
 
-        if(dto.getCategory() != null && dto.getCategory() == 1){
+        if(dto.getCategory() != null && dto.getCategory() == 3){
             Map<String, List<StudentReportRecordPlanPageVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null)
                     .collect(Collectors.groupingBy(StudentReportRecordPlanPageVo::getGraduateSchool));
             List<ItemCountVo> graduatedUniversityList = new ArrayList<>();

+ 2 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentSchoolRollService.java

@@ -60,4 +60,6 @@ public interface IBaseStudentSchoolRollService extends MPJBaseService<BaseStuden
     Boolean activateStudent(Long userId);
 
     Boolean disableStudent(Long userId);
+
+    Boolean disableStudent(Long userId, Long modifyUserId);
 }

+ 10 - 4
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -316,6 +316,12 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         return true;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean disableStudent(Long userId) {
+        return disableStudent(userId, StpUtil.getLoginIdAsLong());
+    }
+
     /**
      * 禁用学生
      * @param userId
@@ -323,12 +329,12 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean disableStudent(Long userId) {
+    public Boolean disableStudent(Long userId, Long modifyUserId) {
         //激活用户信息
         User user = userMapper.selectById(userId);
         user.setDeleteMark(DeleteMark.DELETED.getCode());
         user.setEnabledMark(EnabledMark.DISABLED.getCode());
-        user.setModifyUserId(StpUtil.getLoginIdAsLong());
+        user.setModifyUserId(modifyUserId);
         user.setModifyDate(LocalDateTime.now());
         userMapper.updateById(user);
 
@@ -342,7 +348,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
         updateRoll.setSql("delete_mark = 1");
         updateRoll.setSql("enabled_mark = 0");
         updateRoll.setSql("class_id = null");
-        updateRoll.setSql("modify_user_id = " + StpUtil.getLoginIdAsLong());
+        updateRoll.setSql("modify_user_id = " + modifyUserId);
         updateRoll.setSql("modify_date = now()");
         this.update(schoolRoll, updateRoll);
 
@@ -352,7 +358,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
                         .eq(BaseStudent::getUserId, userId)
         );
         baseStudent.setIsNormal(0);
-        baseStudent.setModifyUserId(StpUtil.getLoginIdAsLong());
+        baseStudent.setModifyUserId(modifyUserId);
         baseStudent.setModifyDate(LocalDateTime.now());
         baseStudentMapper.updateById(baseStudent);
 

+ 3 - 0
src/main/resources/mapper/student/BaseNewStudentMapper.xml

@@ -52,6 +52,9 @@
         <if test="dto.teacherName != null and dto.teacherName != ''">
             AND t12.name like concat('%', #{dto.teacherName}, '%')
         </if>
+        <if test="dto.gender != null and dto.gender != ''">
+            AND t1.gender = #{dto.gender}
+        </if>
         <if test="dto.status != null">
             AND t1.status = #{dto.status}
         </if>

+ 1 - 1
src/main/resources/mapper/student/StudentReportRecordMapper.xml

@@ -297,7 +297,7 @@
         SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
         t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
         t9.name AS stduy_status_cn,t3.gender,t13.name as major_name,t14.name as class_type,
-        t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
+        t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,t3.graduate_school,
         t3.family_mobile AS parent_mobile,t15.name as dept_name
         FROM student_report_record t1
         INNER JOIN base_new_student t3 ON t3.id = t1.user_id

+ 28 - 88
src/test/java/com/xjrsoft/module/liteflow/node/StudentDropOutNodeTest.java

@@ -3,20 +3,15 @@ package com.xjrsoft.module.liteflow.node;
 import cn.hutool.core.convert.Convert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.StudentChangeTypeEnum;
 import com.xjrsoft.common.enums.WorkflowApproveType;
-import com.xjrsoft.module.hikvision.entity.HikvisionData;
-import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
-import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.entity.StudentDropOut;
 import com.xjrsoft.module.student.mapper.StudentDropOutMapper;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.student.service.IStudentChangeRecordService;
 import com.xjrsoft.module.workflow.entity.WorkflowRecord;
 import com.xjrsoft.module.workflow.mapper.WorkflowRecordMapper;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
@@ -28,15 +23,10 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.transaction.support.TransactionSynchronization;
 import org.springframework.transaction.support.TransactionSynchronizationManager;
 
-import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Optional;
-import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 
-import static org.junit.jupiter.api.Assertions.*;
-
 /**
  * @author dzx
  * @date 2024/4/19
@@ -55,90 +45,40 @@ class StudentDropOutNodeTest {
     private WorkflowRecordMapper workflowRecordMapper;
 
     @Autowired
-    private HikvisionDataMapper hikvisionDataMapper;
+    private IStudentChangeRecordService changeRecordService;
 
     @Test
     void test(){
-        Long formId = 1863523681699409920L;
+        Long formId = 1900442309068136448L;
         // 获取表单中数据编号
-        Object processInstanceId = "ee72acf7-b6a0-11ef-9921-0242c8000007";
+        Object processInstanceId = "3f8296aa-00a2-11f0-80c9-0242d2000004";
         String processInstanceIdStr = Convert.toStr(processInstanceId);
         if (formId != null && StringUtils.isNotEmpty(processInstanceIdStr)) {
-            TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
-                @Override
-                public void afterCommit() {
-                    CompletableFuture.runAsync(() -> {
-                        Optional<HistoricProcessInstance> historicProcessInstanceOptional = workflowExecuteService.getHistoricProcessInstance(processInstanceId.toString());
-
-                        if (historicProcessInstanceOptional.isEmpty()) {
-                            return;
-                        }
-                        HistoricProcessInstance historicProcessInstance = historicProcessInstanceOptional.get();
-                        if (!historicProcessInstance.getState().equals(HistoricProcessInstance.STATE_ACTIVE)) {
-                            // 获取流程记录中的非正常结束
-                            LambdaQueryWrapper<WorkflowRecord> workflowRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
-                            workflowRecordLambdaQueryWrapper
-                                    .and(wq -> wq.eq(WorkflowRecord::getWorkflowApproveType, WorkflowApproveType.DISAGREE.getCode())
-                                            .or()
-                                            .eq(WorkflowRecord::getWorkflowApproveType, WorkflowApproveType.WITHDRAW.getCode())
-                                    )
-                                    .eq(WorkflowRecord::getProcessId, processInstanceId)
-                            ;
-                            List<WorkflowRecord> workflowRecordList = workflowRecordMapper.selectList(workflowRecordLambdaQueryWrapper);
-
-                            if (!workflowRecordList.isEmpty()) {
-                                return;
-                            }
-                        }
-
-                        //查询出数据
-                        StudentDropOut studentDropOut = studentDropOutMapper.selectById(formId);
-                        //跟新学籍信息
-                        BaseStudentSchoolRoll schoolRoll = studentSchoolRollService.getOne(
-                                new QueryWrapper<BaseStudentSchoolRoll>().lambda()
-                                        .eq(BaseStudentSchoolRoll::getClassId, studentDropOut.getClassId())
-                                        .eq(BaseStudentSchoolRoll::getUserId, studentDropOut.getStudentUserId())
-                                        .eq(BaseStudentSchoolRoll::getDeleteMark, DeleteMark.NODELETE.getCode())
-                        );
-                        schoolRoll.setArchivesStatus(ArchivesStatusEnum.FB2904.getCode());
-                        studentSchoolRollService.updateById(schoolRoll);
-
-                        //删除海康出入权限
-                        String hikvisionId = hikvisionDataMapper.getStudentHikvisionId(studentDropOut.getStudentUserId());
-                        ApiUtil apiUtil = new ApiUtil();
-                        String apiPath = "/api/pmas/v1/person/batch/delete";
-                        JsonObject paramJson = new JsonObject();
-                        JsonArray personIndexCodes = new JsonArray();
-                        personIndexCodes.add(hikvisionId);
-                        paramJson.add("personIndexCodes", personIndexCodes);
-                        String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+            //查询出数据
+            StudentDropOut studentDropOut = studentDropOutMapper.selectById(formId);
+            //跟新学籍信息
+            BaseStudentSchoolRoll schoolRoll = studentSchoolRollService.getOne(
+                    new QueryWrapper<BaseStudentSchoolRoll>().lambda()
+                            .eq(BaseStudentSchoolRoll::getClassId, studentDropOut.getClassId())
+                            .eq(BaseStudentSchoolRoll::getUserId, studentDropOut.getStudentUserId())
+                            .eq(BaseStudentSchoolRoll::getDeleteMark, DeleteMark.NODELETE.getCode())
+            );
 
-                        JsonParser parser = new JsonParser();
-                        JsonObject resultJson = parser.parse(doPost).getAsJsonObject();
-                        if(resultJson.get("code").getAsInt() == 0){
-                            JsonArray success = resultJson.get("data").getAsJsonObject().get("success").getAsJsonArray();
+            //记录异动
+            changeRecordService.insertData(
+                    ArchivesStatusEnum.fromCode(schoolRoll.getArchivesStatus()),
+                    schoolRoll.getArchivesStatus(),
+                    ArchivesStatusEnum.FB2904.getValue(),
+                    ArchivesStatusEnum.FB2904.getCode(),
+                    studentDropOut.getStudentUserId(),
+                    studentDropOut.getCreateUserId(),
+                    StudentChangeTypeEnum.ArchivesStatus.getCode(),
+                    2
+            );
 
-                            Set<String> valuesSet = new HashSet<>();
-                            String keyToExtract = "indexCode";
-                            // 遍历 JSON 数组并提取指定键的值
-                            for (JsonElement jsonElement : success) {
-                                JsonObject jsonObject = jsonElement.getAsJsonObject();
-                                if (jsonObject.has(keyToExtract)) {
-                                    String value = jsonObject.get(keyToExtract).getAsString();
-                                    valuesSet.add(value);
-                                }
-                            }
-                            if(valuesSet.contains(hikvisionId)){
-                                hikvisionDataMapper.delete(
-                                        new QueryWrapper<HikvisionData>().lambda()
-                                                .eq(HikvisionData::getSourceId, studentDropOut.getClassId())
-                                                .eq(HikvisionData::getHikvisionId, hikvisionId)
-                                );
-                            }
-                        }
-                    });
-                }
-            });
+            schoolRoll.setArchivesStatus(ArchivesStatusEnum.FB2904.getCode());
+            studentSchoolRollService.updateById(schoolRoll);
+            studentSchoolRollService.disableStudent(schoolRoll.getUserId());
         }
     }
 }