WfRoomApplicantNode.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.hikvision.entity.HikvisionData;
  7. import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
  8. import com.xjrsoft.module.hikvision.util.DataUtil;
  9. import com.xjrsoft.module.room.entity.WfRoomApplicant;
  10. import com.xjrsoft.module.room.mapper.WfRoomApplicantMapper;
  11. import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
  12. import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
  13. import com.yomahub.liteflow.core.NodeComponent;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.stereotype.Component;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. /**
  20. * 学生住宿申请后,修改学籍信息中的就读方式
  21. */
  22. @Component("wf_room_applicant_node")
  23. public class WfRoomApplicantNode extends NodeComponent {
  24. @Autowired
  25. private WfRoomApplicantMapper wfRoomApplicantMapper;
  26. @Autowired
  27. private IBaseStudentSchoolRollService studentSchoolRollService;
  28. @Autowired
  29. private HikvisionDataMapper hikvisionDataMapper;
  30. @Override
  31. public void process() throws Exception {
  32. // 获取表单中数据编号
  33. Map<String, Object> params = this.getFirstContextBean();
  34. Object value = util.getFormDatKey(params,"id");
  35. Long formId = Convert.toLong(value);
  36. if (formId != null) {
  37. //查询出数据
  38. WfRoomApplicant wfRoomApplicant = wfRoomApplicantMapper.selectById(formId);
  39. BaseStudentSchoolRoll schoolRoll = studentSchoolRollService.getOne(
  40. new QueryWrapper<BaseStudentSchoolRoll>().lambda()
  41. .eq(BaseStudentSchoolRoll::getUserId, wfRoomApplicant.getApplicantUserId())
  42. );
  43. if(RoomApplicantTypeEnum.ToBeBoarder.getCode().equals(wfRoomApplicant.getRecedeType())){
  44. schoolRoll.setStduyStatus(StudyStatusEnum.InResidence.getCode());
  45. }else if(RoomApplicantTypeEnum.ToBeDayPupil.getCode().equals(wfRoomApplicant.getRecedeType())){
  46. schoolRoll.setStduyStatus(StudyStatusEnum.AttendDaySchool.getCode());
  47. }
  48. //修改学生班级
  49. studentSchoolRollService.updateById(schoolRoll);
  50. String tableName = "base_student";
  51. List<HikvisionData> studentList = hikvisionDataMapper.selectList(
  52. new QueryWrapper<HikvisionData>().lambda().eq(HikvisionData::getTableName, tableName)
  53. );
  54. DataUtil dataUtil = new DataUtil();
  55. dataUtil.insertStudentOne(tableName, new HashMap<>(), studentList, wfRoomApplicant.getApplicantUserId());
  56. }
  57. }
  58. }