|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.emay.sdk.util.StringUtil; | 
|---|
|  |  |  | 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 com.doumee.service.business.third.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.openapi.response.PlatformNumByStatusResponse; | 
|---|
|  |  |  | import com.doumee.dao.openapi.response.PlatformStatusListResponse; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformDeviceService; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import org.apache.commons.lang.StringUtils; | 
|---|
|  |  |  | import org.apache.shiro.SecurityUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  | platform.setEditor(platform.getLoginUserInfo().getId()); | 
|---|
|  |  |  | platform.setEditDate(new Date()); | 
|---|
|  |  |  | Platform model = platformMapper.selectById(platform.getId()); | 
|---|
|  |  |  | if(Objects.isNull(platform.getSortnum())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,月台组信息不正确!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //如果月台分组发生变化 | 
|---|
|  |  |  | Long count =  platformJobJoinMapper.selectCount(  new QueryWrapper<PlatformJob>().lambda() | 
|---|
|  |  |  | Long count =  platformJobJoinMapper.selectCount( new QueryWrapper<PlatformJob>().lambda() | 
|---|
|  |  |  | .eq(PlatformJob::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .notIn(PlatformJob::getStatus,Constants.PlatformJobStatus.WART_SIGN_IN.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.WAIT_CONFIRM.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.DONE.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.LEAVED.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.CANCEL.getKey() | 
|---|
|  |  |  | .eq(PlatformJob::getPlatformId,model.getId()) | 
|---|
|  |  |  | .in(PlatformJob::getStatus,Constants.PlatformJobStatus.IN_WAIT.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.CALLED.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.WORKING.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.TRANSFERING.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.EXCEPTION.getKey() | 
|---|
|  |  |  | ,Constants.PlatformJobStatus.OVER_NUMBER.getKey() | 
|---|
|  |  |  | )); | 
|---|
|  |  |  | if(count!=null && count>0){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前月台有正在作业的任务,不能进行月台组切换操作!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(pageWrap.getModel().getYpos() != null, Platform::getYpos, pageWrap.getModel().getYpos()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getWidth() != null, Platform::getWidth, pageWrap.getModel().getWidth()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getHeight() != null, Platform::getHeight, pageWrap.getModel().getHeight()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getAngle() != null, Platform::getAngle, pageWrap.getModel().getAngle()); | 
|---|
|  |  |  | .eq(pageWrap.getModel().getAngle() != null, Platform::getAngle, pageWrap.getModel().getAngle()) | 
|---|
|  |  |  | .eq(pageWrap.getModel().getType() != null, Platform::getType, pageWrap.getModel().getType()) | 
|---|
|  |  |  | .orderByAsc(Platform::getSortnum) | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | for(PageWrap.SortData sortData: pageWrap.getSorts()) { | 
|---|
|  |  |  | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { | 
|---|
|  |  |  | queryWrapper.orderByDesc(sortData.getProperty()); | 
|---|
|  |  |  | 
|---|
|  |  |  | bean.setUseRata( | 
|---|
|  |  |  | bean.getWorkCountTime().multiply(new BigDecimal(100)).divide(sumTime,BigDecimal.ROUND_HALF_DOWN,2) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | bean.setUseRata(Constants.formatBigdecimal2Float(bean.getUseRata()));//强制保留两位小数 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return platformList; | 
|---|