| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.manager.common.config.UplinkProperties; |
| | | import com.zy.acs.manager.common.domain.TaskDto; |
| | | import com.zy.acs.manager.common.exception.BusinessException; |
| | | import com.zy.acs.manager.manager.entity.Code; |
| | |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.TaskTypeType; |
| | | import com.zy.acs.manager.manager.enums.TaskUplinkStateType; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.LocService; |
| | | import com.zy.acs.manager.manager.service.StaService; |
| | |
| | | private MapService mapService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private UplinkProperties uplinkProperties; |
| | | |
| | | public List<Task> validTaskDtoList(List<TaskDto> taskDtoList) { |
| | | List<Task> taskList = new ArrayList<>(); |
| | | String uplinkSts = uplinkProperties.getEnabled() ? TaskUplinkStateType.PENDING.toString() : TaskUplinkStateType.SKIPPED.toString(); |
| | | for (TaskDto taskDto : taskDtoList) { |
| | | if (Cools.isEmpty(taskDto.getSeqNum())) { |
| | | throw new BusinessException("Task seqNum can't be empty!"); |
| | |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong,oriLoc:" + task.getOriLoc() + " is unable to reach destLoc" + task.getDestLoc()); |
| | | } |
| | | task.setPhase(JSON.toJSONString(pathList)); |
| | | task.setUplinkSts(uplinkSts); |
| | | break; |
| | | case LOC_TO_STA: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong,oriLoc:" + task.getOriLoc() + " can't move to destSta" + task.getDestSta()); |
| | | } |
| | | task.setPhase(JSON.toJSONString(pathList)); |
| | | task.setUplinkSts(uplinkSts); |
| | | break; |
| | | case STA_TO_LOC: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong,oriSta:" + task.getOriSta() + " is unable to react destLoc" + task.getDestLoc()); |
| | | } |
| | | task.setPhase(JSON.toJSONString(pathList)); |
| | | task.setUplinkSts(uplinkSts); |
| | | break; |
| | | case STA_TO_STA: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong,oriSta:" + task.getOriSta() + " can't move to destSta" + task.getDestSta()); |
| | | } |
| | | task.setPhase(JSON.toJSONString(pathList)); |
| | | task.setUplinkSts(uplinkSts); |
| | | break; |
| | | default: |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong, cause this type not exist"); |