WfRoomApplicantNode.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.xjrsoft.module.liteflow.node;
  2. import cn.hutool.core.convert.Convert;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.xjrsoft.common.enums.RoomApplicantTypeEnum;
  5. import com.xjrsoft.common.enums.StudyStatusEnum;
  6. import com.xjrsoft.module.room.entity.WfRoomApplicant;
  7. import com.xjrsoft.module.room.mapper.WfRoomApplicantMapper;
  8. import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
  9. import com.xjrsoft.module.student.entity.StudentChangeClass;
  10. import com.xjrsoft.module.student.mapper.StudentChangeClassMapper;
  11. import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
  12. import com.yomahub.liteflow.core.NodeComponent;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.stereotype.Component;
  15. import java.util.Map;
  16. /**
  17. * 学生住宿申请后,修改学籍信息中的就读方式
  18. */
  19. @Component("wf_room_applicant_node")
  20. public class WfRoomApplicantNode extends NodeComponent {
  21. @Autowired
  22. private WfRoomApplicantMapper wfRoomApplicantMapper;
  23. @Autowired
  24. private IBaseStudentSchoolRollService studentSchoolRollService;
  25. @Override
  26. public void process() throws Exception {
  27. // 获取表单中数据编号
  28. Map<String, Object> params = this.getFirstContextBean();
  29. Object value = util.getFormDatKey(params,"id");
  30. Long formId = Convert.toLong(value);
  31. if (formId != null) {
  32. //查询出数据
  33. WfRoomApplicant wfRoomApplicant = wfRoomApplicantMapper.selectById(formId);
  34. BaseStudentSchoolRoll schoolRoll = studentSchoolRollService.getOne(
  35. new QueryWrapper<BaseStudentSchoolRoll>().lambda()
  36. .eq(BaseStudentSchoolRoll::getUserId, wfRoomApplicant.getApplicantUserId())
  37. );
  38. if(RoomApplicantTypeEnum.ToBeBoarder.getCode().equals(wfRoomApplicant.getRecedeType())){
  39. schoolRoll.setStduyStatus(StudyStatusEnum.InResidence.getCode());
  40. }else if(RoomApplicantTypeEnum.ToBeDayPupil.getCode().equals(wfRoomApplicant.getRecedeType())){
  41. schoolRoll.setStduyStatus(StudyStatusEnum.AttendDaySchool.getCode());
  42. }
  43. //修改学生班级
  44. studentSchoolRollService.updateById(schoolRoll);
  45. }
  46. }
  47. }