| New file |
| | |
| | | package com.zy.acs.manager.core.integrate.conveyor; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.core.integrate.dto.ConveyorQueryParam; |
| | | import com.zy.acs.manager.core.integrate.dto.ConveyorQueryResult; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.StaService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "Open Api") |
| | | @RestController |
| | | @RequestMapping("/api/open") |
| | | public class ConveyorController extends BaseController { |
| | | |
| | | @Autowired |
| | | private StaService staService; |
| | | |
| | | @PostMapping("/station/convey") |
| | | public R save(@RequestBody ConveyorQueryParam param) { |
| | | List<ConveyorQueryResult> resultList = new ArrayList<>(); |
| | | |
| | | List<String> staNos = param.getStaNos(); |
| | | if (Cools.isEmpty(staNos)) { |
| | | List<Sta> list = staService.list(new LambdaQueryWrapper<Sta>() |
| | | .eq(Sta::getStatus, StatusType.ENABLE.val) |
| | | .orderByAsc(Sta::getStaNo) |
| | | ); |
| | | for (Sta sta : list) { |
| | | resultList.add(new ConveyorQueryResult(sta.getStaNo(), Boolean.TRUE)); |
| | | } |
| | | } else { |
| | | for (String staNo : staNos) { |
| | | Sta sta = staService.selectByStaNo(staNo); |
| | | if (null == sta) { |
| | | resultList.add(new ConveyorQueryResult(staNo, Boolean.FALSE)); |
| | | continue; |
| | | } |
| | | resultList.add(new ConveyorQueryResult(staNo, Boolean.TRUE)); |
| | | } |
| | | } |
| | | |
| | | return R.ok().add(resultList); |
| | | } |
| | | |
| | | |
| | | |
| | | } |