派遣记录接口修改,人员被派遣后,修改人员派遣状态为已派遣
| | |
| | | import org.springblade.modules.dispatcher.service.IDispatcherService; |
| | | import org.springblade.modules.dispatcher.service.IDispatcherUnitService; |
| | | import org.springblade.modules.dispatcher.vo.DispatcherVO; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | private final IDispatcherService dispatcherService; |
| | | |
| | | private final IDispatcherUnitService dispatcherUnitService; |
| | | |
| | | private final IUserService userService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入dispatcher") |
| | | public R submit(@Valid @RequestBody Dispatcher dispatcher) { |
| | | if (null!=dispatcher.getUserIds() && dispatcher.getUserIds()!=""){ |
| | | //计算派遣人数 |
| | | dispatcher.setNum(Arrays.asList(dispatcher.getUserIds().split(",")).size()); |
| | | //查询派遣单位的信息,设置行政区 |
| | | dispatcher.setJurisdiction(dispatcherUnitService.getById(dispatcher.getDispatcherUnitId()).getJurisdiction().toString()); |
| | | if (dispatcher.getId()==null){ |
| | | if (null!=dispatcher.getUserIds() && dispatcher.getUserIds()!=""){ |
| | | List<String> list = Arrays.asList(dispatcher.getUserIds().split(",")); |
| | | //计算派遣人数 |
| | | dispatcher.setNum(list.size()); |
| | | //修改保安人员的派遣状态 |
| | | list.forEach(id -> { |
| | | User user = new User(); |
| | | user.setId(Long.parseLong(id)); |
| | | user.setDispatch("0"); |
| | | userService.updateById(user); |
| | | }); |
| | | //查询派遣单位的信息,设置行政区 |
| | | dispatcher.setJurisdiction(dispatcherUnitService.getById(dispatcher.getDispatcherUnitId()).getJurisdiction().toString()); |
| | | } |
| | | } |
| | | else { |
| | | if (null != dispatcher.getUserIds() && dispatcher.getUserIds() != "") { |
| | | List<String> list = Arrays.asList(dispatcher.getUserIds().split(",")); |
| | | //计算派遣人数 |
| | | dispatcher.setNum(list.size()); |
| | | //修改保安人员的派遣状态 |
| | | list.forEach(id -> { |
| | | User user = new User(); |
| | | user.setId(Long.parseLong(id)); |
| | | user.setDispatch("0"); |
| | | userService.updateById(user); |
| | | }); |
| | | //查询派遣单位的信息,设置行政区 |
| | | dispatcher.setJurisdiction(dispatcherUnitService.getById(dispatcher.getDispatcherUnitId()).getJurisdiction().toString()); |
| | | } |
| | | } |
| | | return R.status(dispatcherService.saveOrUpdate(dispatcher)); |
| | | } |
| | |
| | | <!--考试成绩分页信息--> |
| | | <select id="selectExamScorePage" resultType="org.springblade.modules.exam.vo.ExamScoreVO"> |
| | | SELECT |
| | | id,candidate_no candidateNo,theory_grade theoryGrade,ifnull(learn_grade,-1) learnGrade,all_grade, |
| | | exam_name examName,security_name securityName,exam_type examType,company,exam_time examTime, |
| | | all_score allScore,exam_end_time examEndTime,qualified |
| | | es.id,es.theory_grade theoryGrade,ifnull(learn_grade,-1) learnGrade, |
| | | exam_name examName,bu.real_name securityName,company,exam_time examTime, |
| | | all_score allScore,exam_end_time examEndTime,qualified, |
| | | bd.dept_name companyName |
| | | FROM |
| | | exam_score |
| | | exam_score es |
| | | left join |
| | | blade_user bu |
| | | on |
| | | es.user_id = bu.id |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = es.company |
| | | WHERE |
| | | 1=1 |
| | | 1=1 |
| | | <if test="examScore.examName!=null and examScore.examName!=''"> |
| | | and exam_name like concat('%', #{examScore.examName},'%') |
| | | and es.exam_name like concat('%', #{examScore.examName},'%') |
| | | </if> |
| | | <if test="examScore.company!=null and examScore.company!=''"> |
| | | and company like concat('%', #{examScore.company},'%') |
| | | <if test="examScore.companyName!=null and examScore.companyName!=''"> |
| | | and bd.dept_name like concat('%', #{examScore.companyName},'%') |
| | | </if> |
| | | <if test="examScore.securityName!=null and examScore.securityName!=''"> |
| | | and security_name like concat('%', #{examScore.securityName},'%') |
| | | and bu.real_name like concat('%', #{examScore.securityName},'%') |
| | | </if> |
| | | <if test="examScore.userId!=null and examScore.userId!=''"> |
| | | and user_id = #{examScore.userId} |
| | | and es.user_id = #{examScore.userId} |
| | | </if> |
| | | <if test="examScore.candidateNo!=null and examScore.candidateNo!=''"> |
| | | and candidate_no = #{examScore.candidateNo} |
| | | and es.candidate_no = #{examScore.candidateNo} |
| | | </if> |
| | | <!-- <if test="examScore.examType!=null">--> |
| | | <!-- and exam_type = #{examScore.examType}--> |
| | | <!-- </if>--> |
| | | <if test="examScore.qualified!=null"> |
| | | and es.qualified = #{examScore.qualified} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--考试成绩详情信息--> |
| | |
| | | @Override |
| | | public IPage<TrainingRegistrationVo> selectTrainingRegistrationPage(IPage<TrainingRegistrationVo> page, TrainingRegistrationVo trainingRegistration) { |
| | | List<TrainingRegistrationVo> trainingRegistrationVos = baseMapper.selectTrainingRegistrationPage(page, trainingRegistration); |
| | | trainingRegistrationVos.forEach(trainingRegistrationVo -> { |
| | | trainingRegistrationVo.setRemainingTime(LongTimeUtil.getDistanceTime(trainingRegistrationVo.getTrainExamTime().getTime(), System.currentTimeMillis())); |
| | | }); |
| | | if (trainingRegistrationVos.size()>0) { |
| | | trainingRegistrationVos.forEach(trainingRegistrationVo -> { |
| | | if (null!=trainingRegistrationVo.getTrainExamTime()) { |
| | | trainingRegistrationVo.setRemainingTime(LongTimeUtil.getDistanceTime(trainingRegistrationVo.getTrainExamTime().getTime(), System.currentTimeMillis())); |
| | | } |
| | | }); |
| | | } |
| | | return page.setRecords(trainingRegistrationVos); |
| | | } |
| | | |