| | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.PlatformMapper; |
| | | import com.doumee.dao.business.join.PlatformJoinMapper; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.Platform; |
| | | import com.doumee.dao.business.model.PlatformGroup; |
| | | import com.doumee.dao.openapi.response.PlatformNumByStatusResponse; |
| | | import com.doumee.service.business.PlatformService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 月台信息表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private PlatformMapper platformMapper; |
| | | @Autowired |
| | | private PlatformJoinMapper platformJoinMapper; |
| | | |
| | | @Override |
| | | public Integer create(Platform platform) { |
| | |
| | | public void updateById(Platform platform) { |
| | | platformMapper.updateById(platform); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStatusById(Platform platform) { |
| | | Platform model =platformMapper.selectById(platform.getId()); |
| | |
| | | QueryWrapper<Platform> wrapper = new QueryWrapper<>(platform); |
| | | return platformMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PlatformNumByStatusResponse getPlatformNumByStatusResponse(){ |
| | | PlatformNumByStatusResponse platformNumByStatusResponse = new PlatformNumByStatusResponse(); |
| | | List<Platform> platformList = platformJoinMapper.selectJoinList(Platform.class,new MPJLambdaWrapper<Platform>() |
| | | .selectAll(Platform.class) |
| | | .select(" ( select count(1) from platform_job pj where t.id = pj.PLATFORM_ID and pj.STATUS = "+Constants.PlatformJobStatus.WORKING.getKey()+" ) as workStatus ") |
| | | .eq(Platform::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformList)){ |
| | | //停用数量 |
| | | platformNumByStatusResponse.setForbiddenNum( |
| | | platformList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)).collect(Collectors.toList()).size() |
| | | ); |
| | | //工作数量 |
| | | platformNumByStatusResponse.setUsingNum( |
| | | platformList.stream().filter(i->i.getWorkStatus()>Constants.ZERO).collect(Collectors.toList()).size() |
| | | ); |
| | | //空闲数量 |
| | | platformNumByStatusResponse.setIdleNum( |
| | | platformList.stream().filter(i->i.getWorkStatus()<=Constants.ZERO).collect(Collectors.toList()).size() |
| | | ); |
| | | } |
| | | return platformNumByStatusResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |