dzx пре 6 месеци
родитељ
комит
e912f0be4d

+ 2 - 0
src/main/java/com/xjrsoft/module/banding/service/IBandingTaskClassStudentService.java

@@ -57,4 +57,6 @@ public interface IBandingTaskClassStudentService extends MPJBaseService<BandingT
     Boolean insertStudent(ChangeClassDto dto);
 
     Boolean syncStudentData(StudentReportPlan studentReportPlan);
+
+    Boolean changeClassByWorkFlow(Long userId, Long classId);
 }

+ 35 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -458,4 +458,39 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
         return true;
     }
 
+    @Override
+    @Transactional
+    public Boolean changeClassByWorkFlow(Long userId, Long classId) {
+        User user = userService.getById(userId);
+        if(user == null){
+            return false;
+        }
+        BaseNewStudent newStudent = newStudentService.getOne(
+                new QueryWrapper<BaseNewStudent>().lambda()
+                        .eq(BaseNewStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(BaseNewStudent::getCredentialNumber, user.getCredentialNumber())
+        );
+        BandingTaskClass taskClass = taskClassMapper.selectOne(
+                new QueryWrapper<BandingTaskClass>().lambda()
+                        .eq(BandingTaskClass::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(BandingTaskClass::getBaseClassId, classId)
+        );
+        if(newStudent != null && taskClass != null){
+            this.remove(
+                    new QueryWrapper<BandingTaskClassStudent>().lambda()
+                            .eq(BandingTaskClassStudent::getNewStudentId, newStudent.getId())
+            );
+
+            this.save(new BandingTaskClassStudent(){{
+                setCreateDate(new Date());
+                setBandingTaskClassId(taskClass.getId());
+                setNewStudentId(newStudent.getId());
+                setStatus(1);
+                setDeleteMark(DeleteMark.NODELETE.getCode());
+                setEnabledMark(EnabledMark.ENABLED.getCode());
+            }});
+        }
+        return null;
+    }
+
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/liteflow/node/StudentChangeClassNode.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.liteflow.node;
 import cn.hutool.core.convert.Convert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.xjrsoft.common.enums.WorkflowApproveType;
+import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.student.entity.StudentChangeClass;
@@ -46,6 +47,9 @@ public class StudentChangeClassNode extends NodeComponent {
     @Autowired
     private IStudentChangeRecordService changeRecordService;
 
+    @Autowired
+    private IBandingTaskClassStudentService taskClassStudentService;
+
     @Override
     public void process() throws Exception {
         // 获取表单中数据编号
@@ -93,6 +97,8 @@ public class StudentChangeClassNode extends NodeComponent {
                         studentSchoolRollService.updateStudentClass(changeClass.getAfterClassId(), baseClass.getMajorSetId(), changeClass.getStudentUserId());
 
                         changeRecordService.insertDataByChangeClass(formId);
+
+                        taskClassStudentService.changeClassByWorkFlow(changeClass.getStudentUserId(), changeClass.getAfterClassId());
                     });
                 }
             });

+ 6 - 0
src/main/java/com/xjrsoft/module/liteflow/node/TemporaryChangeClassNode.java

@@ -5,6 +5,7 @@ import cn.hutool.db.Entity;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.xjrsoft.common.enums.WorkflowApproveType;
 import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
+import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
@@ -44,6 +45,9 @@ public class TemporaryChangeClassNode extends NodeComponent {
     @Autowired
     private IStudentChangeRecordService changeRecordService;
 
+    @Autowired
+    private IBandingTaskClassStudentService taskClassStudentService;
+
     @Override
     public void process() throws Exception {
         // 获取表单中数据编号
@@ -95,6 +99,8 @@ public class TemporaryChangeClassNode extends NodeComponent {
                         studentSchoolRollService.updateStudentClass(afterClassId, baseClass.getMajorSetId(), studentUserId);
 
                         changeRecordService.insertDataByTemporaryChangeClass(formId);
+
+                        taskClassStudentService.changeClassByWorkFlow(studentUserId, afterClassId);
                     });
                 }
             });