| | |
| | | import com.zy.acs.manager.manager.mapper.BusMapper; |
| | | import com.zy.acs.manager.manager.service.BusService; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.manager.service.TaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Slf4j |
| | | @Service("busService") |
| | | public class BusServiceImpl extends ServiceImpl<BusMapper, Bus> implements BusService { |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | @Override |
| | | public Bus selectByUuid(String uuid) { |
| | |
| | | if (Cools.isEmpty(param.getBatch())) { |
| | | return "Batch cannot be empty!"; |
| | | } |
| | | Set<String> oriStaNoSet = new HashSet<>(); |
| | | Set<String> oriLocNoSet = new HashSet<>(); |
| | | Set<String> destStaNoSet = new HashSet<>(); |
| | | Set<String> destLocNoSet = new HashSet<>(); |
| | | for (TaskDto dto : param.getTaskList()) { |
| | | if (!Cools.isEmpty(dto.getOriSta()) && !Cools.isEmpty(dto.getOriLoc())) { |
| | | return "OriSta and OriLoc cannot exist at the same time!"; |
| | | } |
| | | if (Cools.isEmpty(dto.getOriSta()) && Cools.isEmpty(dto.getOriLoc())) { |
| | | return "OriSta and OriLoc must have one!"; |
| | | } |
| | | if (!Cools.isEmpty(dto.getOriSta())) { |
| | | if (!Cools.isEmpty(dto.getOriLoc())) { |
| | | return "OriSta and OriLoc cannot exist at the same time!"; |
| | | } |
| | | if (Cools.isEmpty(dto.getDestSta()) && Cools.isEmpty(dto.getDestLoc())) { |
| | | return "Destination cannot be empty!"; |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(dto.getDestSta())) { |
| | | if (!Cools.isEmpty(dto.getDestLoc())) { |
| | | return "DestSta and DestLoc cannot exist at the same time!"; |
| | | if (!Cools.isEmpty(dto.getOriLoc())) { |
| | | if (Cools.isEmpty(dto.getDestSta()) && Cools.isEmpty(dto.getDestLoc())) { |
| | | return "Destination cannot be empty!"; |
| | | } |
| | | if (oriLocNoSet.contains(dto.getOriLoc())) { |
| | | return "OriLoc cannot be repeated"; |
| | | } else { |
| | | oriLocNoSet.add(dto.getOriLoc()); |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(dto.getDestSta()) && !Cools.isEmpty(dto.getDestLoc())) { |
| | | return "DestSta and DestLoc cannot exist at the same time!"; |
| | | } |
| | | if (Cools.isEmpty(dto.getDestSta()) && Cools.isEmpty(dto.getDestLoc())) { |
| | | return "DestSta and DestLoc must have one!"; |
| | | } |
| | | if (!Cools.isEmpty(dto.getDestSta())) { |
| | | if (Cools.isEmpty(dto.getOriSta()) && Cools.isEmpty(dto.getOriLoc())) { |
| | | return "Origin cannot be empty!"; |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(dto.getDestLoc())) { |
| | | if (Cools.isEmpty(dto.getOriSta()) && Cools.isEmpty(dto.getOriLoc())) { |
| | | return "Origin cannot be empty!"; |
| | | } |
| | | if (destLocNoSet.contains(dto.getDestLoc())) { |
| | | return "DestLoc cannot be repeated"; |
| | | } else { |
| | | destLocNoSet.add(dto.getDestLoc()); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(dto.getSeqNum())) { |
| | | dto.setSeqNum(taskService.generateSeqNum()); |
| | | } |
| | | |
| | | } |
| | | return null; |