| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.entity.TaskDetl; |
| | | import com.zy.asrs.entity.TaskDetlLog; |
| | | import com.zy.asrs.entity.TaskLog; |
| | | import com.zy.asrs.mapper.TaskLogMapper; |
| | | import com.zy.asrs.service.TaskDetlLogService; |
| | | import com.zy.asrs.service.TaskDetlService; |
| | | import com.zy.asrs.service.TaskLogService; |
| | | import com.zy.asrs.service.TaskService; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service("taskLogService") |
| | |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private TaskDetlService taskDetlService; |
| | | @Autowired |
| | | private TaskDetlLogService taskDetlLogService; |
| | | |
| | | /** |
| | | * @author Ryan |
| | |
| | | } |
| | | TaskLog taskLog = new TaskLog(); |
| | | BeanUtils.copyProperties(task, taskLog); |
| | | taskLog.setLogId(task.getId()); |
| | | |
| | | if (!this.insert(taskLog)) { |
| | | throw new CoolException("任务日志保存失败!!"); |
| | | } |
| | | |
| | | return false; |
| | | List<TaskDetl> detls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkNo)); |
| | | if (Objects.isNull(detls) || detls.isEmpty()) { |
| | | throw new CoolException("数据错误:任务不存在!!"); |
| | | } |
| | | detls.forEach(detl -> { |
| | | TaskDetlLog detlLog = new TaskDetlLog(); |
| | | BeanUtils.copyProperties(detl, detlLog); |
| | | detlLog.setId(null); |
| | | detlLog.setTaskID(taskLog.getId()); |
| | | if (!taskDetlLogService.insert(detlLog)) { |
| | | throw new CoolException("工作档明细历史保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | } |