| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Override |
| | | public Integer create(PlatformGroup platformGroup) { |
| | | if(platformGroup.getType() ==null |
| | | || platformGroup.getType()>2 |
| | | || platformGroup.getType()<0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(platformGroupMapper.selectCount(new QueryWrapper<PlatformGroup>().lambda() |
| | | .eq(PlatformGroup::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformGroup::getType,platformGroup.getType()) |
| | | )>0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,该类型分组已经创建,请返回刷新页面查看!"); |
| | | } |
| | | platformGroup.setStatus(Constants.ZERO); |
| | | platformGroup.setIsdeleted(Constants.ZERO); |
| | | platformGroup.setCreator(platformGroup.getLoginUserInfo().getId()); |
| | | platformGroup.setCreateDate(new Date()); |
| | | platformGroup.setEditDate(platformGroup.getCreateDate()); |
| | | platformGroup.setEditor(platformGroup.getCreator()); |
| | | platformGroupMapper.insert(platformGroup); |
| | | return platformGroup.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | platformGroupMapper.deleteById(id); |
| | | PlatformGroup param = new PlatformGroup(); |
| | | param.setId(id); |
| | | param.setIsdeleted(Constants.ONE); |
| | | platformGroupMapper.updateById(param); |
| | | } |
| | | @Override |
| | | public void deleteById(Integer id,LoginUserInfo user) { |
| | | // platformGroupMapper.deleteById(id); |
| | | PlatformGroup param = new PlatformGroup(); |
| | | param.setId(id); |
| | | param.setIsdeleted(Constants.ONE); |
| | | param.setEditor(user.getId()); |
| | | param.setEditDate(new Date()); |
| | | platformGroupMapper.updateById(param); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | platformGroupMapper.deleteBatchIds(ids); |
| | | for(Integer id : ids){ |
| | | deleteById(id); |
| | | } |
| | | } |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids,LoginUserInfo user) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for(Integer id : ids){ |
| | | deleteById(id,user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(PlatformGroup platformGroup) { |
| | | if(platformGroup.getType() ==null |
| | | || platformGroup.getType()>2 |
| | | || platformGroup.getType()<0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(platformGroupMapper.selectCount(new QueryWrapper<PlatformGroup>().lambda() |
| | | .eq(PlatformGroup::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformGroup::getType,platformGroup.getType()) |
| | | .ne(PlatformGroup::getId,platformGroup.getId()) |
| | | )>0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,该类型分组已经创建,请返回刷新页面查看!"); |
| | | } |
| | | platformGroup.setEditDate(new Date()); |
| | | platformGroup.setEditor(platformGroup.getLoginUserInfo().getId()); |
| | | platformGroupMapper.updateById(platformGroup); |
| | | } |
| | | |
| | |
| | | List<Platform> allPlatformList = 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) |
| | | //TODO 待确认月台状态字段 |
| | | .eq(Platform::getStatus, Constants.ZERO) |
| | | .eq(Objects.nonNull(queryType)&&!Constants.equalsInteger(queryType,Constants.ZERO),Platform::getStatus,Constants.ZERO) |
| | | ); |
| | | //处理我的月台信息 是否配置隐藏 |