| | |
| | | import com.doumee.core.haikang.model.param.respose.PageSensorStatusResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.PlatformJobMapper; |
| | | import com.doumee.dao.business.PlatformLogMapper; |
| | | import com.doumee.dao.business.PlatformMapper; |
| | | import com.doumee.dao.business.model.Platform; |
| | | import com.doumee.dao.business.model.PlatformJob; |
| | | import com.doumee.dao.web.response.platformReport.CarmeraListVO; |
| | | import com.doumee.dao.web.response.platformReport.OnSitDispatchBoardVO; |
| | | import com.doumee.dao.web.response.platformReport.RegionTreeVO; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.web.response.platformReport.*; |
| | | import com.doumee.service.business.third.BoardService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private PlatformLogMapper platformLogMapper; |
| | | @Autowired |
| | | private PlatformWarnEventMapper platformWarnEventMapper; |
| | | @Autowired |
| | | private PlatformJobMapper platformJobMapper; |
| | | @Autowired |
| | | private PlatformWmsDetailMapper platformWmsDetailMapper; |
| | | @Autowired |
| | | private PlatformMapper platformMapper; |
| | | /** |
| | |
| | | return allList; |
| | | } |
| | | @Override |
| | | public List<PlatformGroupFinishVO> platformGroupFinish(){ |
| | | List<PlatformGroupFinishVO> data = new ArrayList<>(); |
| | | List<PlatformWmsDetail> jobList = platformWmsDetailMapper.selectJoinList(PlatformWmsDetail.class, new MPJLambdaWrapper<PlatformWmsDetail>() |
| | | .selectSum( PlatformWmsDetail::getIoQty) |
| | | .selectAs(PlatformGroup::getName, PlatformWmsDetail::getGroupName) |
| | | .leftJoin(PlatformJob.class,PlatformJob::getId,PlatformWmsDetail::getJobId) |
| | | .rightJoin(PlatformGroup.class,PlatformGroup::getId,PlatformJob::getPlatformGroupId) |
| | | .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO) |
| | | .eq(PlatformJob::getIsdeleted, Constants.ZERO) |
| | | .in(PlatformJob::getStatus, Constants.PlatformJobStatus.DONE.getKey() |
| | | , Constants.PlatformJobStatus.AUTHED_LEAVE.getKey() |
| | | , Constants.PlatformJobStatus.LEAVED.getKey()) |
| | | .apply("to_days(t1.create_data) = to_days(now())") |
| | | .groupBy(PlatformGroup::getId) |
| | | ); |
| | | if(jobList!=null){ |
| | | for(PlatformWmsDetail d : jobList){ |
| | | PlatformGroupFinishVO t = new PlatformGroupFinishVO(); |
| | | t.setFinishData(Constants.formatBigdecimal(d.getIoQty()).intValue()); |
| | | t.setPlatformGroupName(d.getGroupName()); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | @Override |
| | | public CarWorkSituationVO carWorkSituation(int limit){ |
| | | CarWorkSituationVO carWorkSituationVO = new CarWorkSituationVO(); |
| | | List<PlatformLog> platformLogList = platformLogMapper.selectList(new QueryWrapper<PlatformLog>().lambda() |
| | | .orderByDesc(PlatformLog::getCreateDate) |
| | | .last(" limit "+limit) |
| | | ); |
| | | carWorkSituationVO.setPlatformLogList(platformLogList); |
| | | return carWorkSituationVO; |
| | | } |
| | | @Override |
| | | public List<PlatformDurationVO> platformDuration(){ |
| | | List<PlatformDurationVO> platformDurationList = new ArrayList<>(); |
| | | List<Platform> jobList = platformMapper.selectJoinList(Platform.class, new MPJLambdaWrapper<Platform>() |
| | | .selectAll( Platform.class) |
| | | .select(" ( select ROUND( ifnull(SUM(pl.PARAM3),0)/60 , 2 ) from platform_log pl where pl.remark = t.id and to_days(pl.CREATE_DATE) =to_days now())",Platform::getWorkCountTime) |
| | | .eq(Platform::getIsdeleted, Constants.ZERO) |
| | | ); |
| | | if(jobList!=null){ |
| | | //æå·¥ä½æ¶é¿ç´¯è®¡ååºæåº |
| | | Collections.sort(jobList, new Comparator<Platform>() { |
| | | @Override |
| | | public int compare(Platform o1, Platform o2) { |
| | | return Constants.formatBigdecimal(o2.getWorkCountTime())-Constants.formatBigdecimal(o1.getWorkCountTime()); |
| | | } |
| | | }); |
| | | for(Platform model : jobList){ |
| | | PlatformDurationVO data = new PlatformDurationVO(); |
| | | data.setPlatformId(model.getId()); |
| | | data.setPlatformName(model.getName()); |
| | | data.setWorkTotalTime(Constants.formatBigdecimal(model.getWorkCountTime()).intValue()); |
| | | platformDurationList.add(data); |
| | | } |
| | | } |
| | | |
| | | return platformDurationList; |
| | | } |
| | | @Override |
| | | public List<PlatformWarnEvent> warningList(int limit){ |
| | | List<PlatformWarnEvent> platformLogList = platformWarnEventMapper.selectList(new QueryWrapper<PlatformWarnEvent>().lambda() |
| | | .eq(PlatformWarnEvent::getIsdeleted,Constants.ZERO) |
| | | .orderByDesc(PlatformWarnEvent::getCreateDate) |
| | | .last(" limit "+limit) |
| | | ); |
| | | return platformLogList; |
| | | } |
| | | @Override |
| | | public OnSitDispatchBoardVO getCnddCenterData(){ |
| | | OnSitDispatchBoardVO data = new OnSitDispatchBoardVO(); |
| | | //æå°æ»æ° |
| | |
| | | //-------------TODO----------ãçæ¿ãç±ç¡®è®¤éæ±-------------- |
| | | // * 0å¾
确认 1å¾
ç¾å° 2çå¾
å«å· 3å
¥åçå¾
4å·²å«å· 5ä½ä¸ä¸ 6ä½ä¸å®æ 7è½¬ç§»ä¸ 8å¼å¸¸æèµ· 9å·²ææç¦»å 10已离å 11 å·²è¿å· 12已忶 |
| | | for(PlatformJob model : jobList){ |
| | | //é¢çº¦è½¦è¾ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WAIT_CONFIRM.getKey()) |
| | | ||Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){ |
| | | //å¾
确认 ï¼é¢çº¦è½¦ï¼ |
| | | if( Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WAIT_CONFIRM.getKey())){ |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // ä½ä¸è½¦è¾ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){ |
| | | data.setWorkingCar(data.getWorkingCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | //å¾
ç¾å°ï¼é¢çº¦è½¦ï¼ |
| | | if( Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){ |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | //æéè½¦è¾ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey()) |
| | | ||Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.IN_WAIT.getKey())){ |
| | | //çå¾
å«å·ï¼é¢çº¦è½¦ãç¾å°æ°ãæéè½¦ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setLineUpCar(data.getLineUpCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | //å
¥åçå¾
ï¼é¢çº¦è½¦ãç¾å°æ°ï¼ |
| | | if( Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.IN_WAIT.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | //å·²å«å·ï¼é¢çº¦è½¦ãç¾å°æ°ãå·²å«å·ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.CALLED.getKey()) ){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setCalledNum(data.getCalledNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // ä½ä¸è½¦è¾ï¼é¢çº¦è½¦ãç¾å°æ°ãå·²å«å·ãä½ä¸è½¦ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setCalledNum(data.getCalledNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setWorkedNum(data.getWorkedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // ä½ä¸å®æï¼é¢çº¦è½¦ãç¾å°æ°ãå·²å«å·ãä½ä¸è½¦ãå·²å®æï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setCalledNum(data.getCalledNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setWorkedNum(data.getWorkedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setDoneNum(data.getDoneNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // 转移ä¸ï¼é¢çº¦è½¦ãç¾å°æ°ãæéè½¦ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.TRANSFERING.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setLineUpCar(data.getLineUpCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // å·²ææç¦»åï¼é¢çº¦è½¦ãç¾å°æ°ãå·²å«å·ãä½ä¸è½¦ãå·²å®æï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setCalledNum(data.getCalledNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setWorkedNum(data.getWorkedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setDoneNum(data.getDoneNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // 已离å |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.LEAVED.getKey())){ |
| | | data.setWorkingCar(data.getWorkingCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // å·²è¿å·ï¼é¢çº¦è½¦ãç¾å°æ°ãæéè½¦ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.OVER_NUMBER.getKey())){ |
| | | data.setSignedNum(data.getSignedNum()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | data.setLineUpCar(data.getLineUpCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | // 已忶(é¢çº¦è½¦ï¼ |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.PlatformJobStatus.CANCEL.getKey())){ |
| | | data.setReservationCar(data.getReservationCar()+Constants.formatIntegerNum(model.getCountum())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |