| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.estate.expert.admin.domain.business.check.Check; |
| | | import com.estate.expert.admin.domain.business.check.CheckVo; |
| | | import com.estate.expert.admin.domain.business.client.Client; |
| | | import com.estate.expert.admin.domain.common.request.AddCheckInfoRequest; |
| | | import com.estate.expert.admin.domain.common.request.EditCheckInfoRequest; |
| | | 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.repository.CheckMapper; |
| | | import com.estate.expert.admin.domain.user.User; |
| | | import com.estate.expert.admin.service.CheckService; |
| | | import com.estate.expert.admin.service.CheckTaskService; |
| | | import com.estate.expert.admin.service.ClientService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class CheckServiceImpl extends ServiceImpl<CheckMapper, Check> implements CheckService { |
| | | |
| | | @Autowired |
| | | private CheckTaskService checkTaskService; |
| | | |
| | | @Autowired |
| | | private ClientService clientService; |
| | | |
| | | @Override |
| | | public List<CheckVo> pageList(Page<CheckVo> page, OnDutyRequest request) { |
| | |
| | | @Override |
| | | @Transactional |
| | | public void addCheckInfo(User creator, AddCheckInfoRequest 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("委托方不存在"); |
| | | } |
| | | // 1. 创建 Check 实体对象(MyBatis Plus 实体) |
| | | Check check = new Check(); |
| | | |
| | |
| | | |
| | | // 3. 设置关联字段 |
| | | check.setCheckTaskId(request.getCheckTaskIdId()); |
| | | |
| | | check.setPlanId(checkTask.getPlan().getId()); |
| | | check.setProjectId(checkTask.getProject().getId()); |
| | | check.setClientId(client.getId()); |
| | | // 4. 设置创建者ID(MyBatis Plus 使用 creatorId 字段) |
| | | check.setCreatorId(creator.getId()); |
| | | |