| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.estate.expert.admin.domain.business.client.Client; |
| | | import com.estate.expert.admin.domain.business.onduty.OnDuty; |
| | | import com.estate.expert.admin.domain.business.onduty.OnDutyVo; |
| | | import com.estate.expert.admin.domain.business.position.Position; |
| | |
| | | import com.estate.expert.admin.domain.common.request.OnDutyRequest; |
| | | import com.estate.expert.admin.domain.common.request.PageReq; |
| | | import com.estate.expert.admin.domain.common.response.PageRespMp; |
| | | import com.estate.expert.admin.domain.exam.task.check.CheckTask; |
| | | import com.estate.expert.admin.domain.project.Project; |
| | | import com.estate.expert.admin.domain.project.ProjectRepository; |
| | | import com.estate.expert.admin.domain.repository.OnDutyMapper; |
| | | import com.estate.expert.admin.domain.user.User; |
| | | import com.estate.expert.admin.service.CheckTaskService; |
| | | import com.estate.expert.admin.service.ClientService; |
| | | import com.estate.expert.admin.service.OnDutyService; |
| | | import com.estate.expert.admin.service.PositionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @Resource |
| | | private PositionService positionService; |
| | | |
| | | @Autowired |
| | | private CheckTaskService checkTaskService; |
| | | |
| | | @Autowired |
| | | private ClientService clientService; |
| | | @Override |
| | | public List<OnDutyVo> pageList(Page<OnDutyVo> page, OnDutyRequest request) { |
| | | String sTime =null; |
| | |
| | | @Override |
| | | @Transactional |
| | | public OnDuty add(User creator, AddOnDutyRequest request) { |
| | | //1.校验任务id |
| | | CheckTask checkTask = checkTaskService.get(request.getCheckTaskIdId()); |
| | | if (Objects.isNull(checkTask)) { |
| | | throw new RuntimeException("检查任务不存在"); |
| | | } |
| | | Client client = clientService.get(checkTask.getProject().getClient().getId()); |
| | | if (Objects.isNull(client)) { |
| | | throw new RuntimeException("委托方不存在"); |
| | | } |
| | | // 2. 查询岗位信息,获取 positionName(MyBatis Plus 方式) |
| | | Position position = positionService.getById(request.getPositionId()); |
| | | if (position == null) { |
| | |
| | | onDuty.setRemark(request.getRemark()); |
| | | onDuty.setImg(imgStr); |
| | | onDuty.setState(request.getState()); |
| | | |
| | | onDuty.setPlanId(checkTask.getPlan().getId()); |
| | | onDuty.setProjectId(checkTask.getProject().getId()); |
| | | onDuty.setClientId(client.getId()); |
| | | // 5. 设置创建者 |
| | | onDuty.setCreatorId(creator.getId()); |
| | | |