From 17efddc6a667670dca682bf36b51a43e99615e6d Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期三, 16 十月 2024 15:59:38 +0800 Subject: [PATCH] 代码初始化 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 73 ++++++++++++++++++++++++++++++------ 1 files changed, 60 insertions(+), 13 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java index 9a6b9e0..30c9d7c 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java @@ -191,10 +191,12 @@ .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName) .selectAs(PlatformWmsJob::getIoCreatedate,PlatformJob::getIoCreatedate) .selectAs(SystemUser::getRealname,PlatformJob::getOutUserName) + .selectAs(PlatformBooks::getId,PlatformJob::getBookId) .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId) .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode) .leftJoin(SystemUser.class,SystemUser::getId,PlatformJob::getOutUserId) + .leftJoin(PlatformBooks.class,PlatformBooks::getJobId,PlatformJob::getId) .eq(pageWrap.getModel().getId() != null, PlatformJob::getId, pageWrap.getModel().getId()) .eq(pageWrap.getModel().getCreator() != null, PlatformJob::getCreator, pageWrap.getModel().getCreator()) .ge(pageWrap.getModel().getCreateDate() != null, PlatformJob::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())) @@ -271,14 +273,17 @@ .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId()) .apply(pageWrap.getModel().getQueryStatus() != null, " find_in_set(t.`STATUS`,'"+pageWrap.getModel().getQueryStatus()+"')") + .apply(pageWrap.getModel().getQueryStatusForPower() != null, " find_in_set(t.`STATUS`,'"+pageWrap.getModel().getQueryStatusForPower()+"')") .apply(pageWrap.getModel().getQueryType() != null, " find_in_set(t.TYPE,'"+pageWrap.getModel().getQueryType()+"')") .ge(pageWrap.getModel().getBeginWorkDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(pageWrap.getModel().getBeginWorkDateStart())) .le(pageWrap.getModel().getBeginWorkDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(pageWrap.getModel().getBeginWorkDateEnd())) + .ge(pageWrap.getModel().getBeginDoneDateStart() != null, PlatformJob::getDoneDate, Utils.Date.getStart(pageWrap.getModel().getBeginDoneDateStart())) + .le(pageWrap.getModel().getBeginDoneDateEnd() != null, PlatformJob::getDoneDate, Utils.Date.getEnd(pageWrap.getModel().getBeginDoneDateEnd())) .ge(pageWrap.getModel().getCreateDateStart() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getStart(pageWrap.getModel().getCreateDateStart())) .le(pageWrap.getModel().getCreateDateEnd() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getEnd(pageWrap.getModel().getCreateDateEnd())) - .eq(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ONE,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh) - .ne(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ZERO,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh) + .isNotNull(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ONE,pageWrap.getModel().getJobType()), PlatformJob::getContractNum) + .isNull(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ZERO,pageWrap.getModel().getJobType()), PlatformJob::getContractNum) ; for(PageWrap.SortData sortData: pageWrap.getSorts()) { @@ -1093,7 +1098,7 @@ if(Constants.equalsInteger(device.getType(),Constants.ZERO)&&sendLed){ log.error("璋冭捣led------------------------------------------------------------------------------------------"); //濡傛灉鏄疞ED - PlatformBroadcastLog log = HkSyncPushServiceImpl.dealLedContentBiz(device.getHkNo(),device.getName(),ledContent,speed,1); + PlatformBroadcastLog log = HkSyncPushServiceImpl.dealLedContentBiz(model.getId(),device.getHkNo(),device.getName(),ledContent,speed,1); logList.add(log); ledList.add(device.getHkId()); }else if(Constants.equalsInteger(device.getType(),Constants.TWO)&&sendBroadcast){ @@ -1170,8 +1175,9 @@ SmsConstants.platformJobContent.platformJobMove,oldPlatform.getName(),platform.getName() ); - this.broadcastAndLEed(platformJob,null, - StringUtils.isBlank(oldPlatform.getRemark())?Constants.PlatformLedContent.IDEL_CONTNET.getName():oldPlatform.getRemark() + platformJob.setPlatformName(platform.getName()); + this.broadcastAndLEed(platformJob, StringUtils.isBlank(oldPlatform.getRemark())?Constants.PlatformLedContent.IDEL_CONTNET.getName():oldPlatform.getLedContent(), + null ); } @@ -1731,7 +1737,7 @@ if (Objects.isNull(platformJob.getWorkNum()) || Objects.isNull(platformJob.getWorkRate())) { platformDataListResponse.setFinishTime(null); } else { - Integer workMinute = platformJob.getWorkNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate()).intValue(); + Integer workMinute = platformJob.getWorkNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate(),0,BigDecimal.ROUND_HALF_UP).intValue(); Date overDate = DateUtil.getXMinuteAfterDate(platformJob.getNewStartDate(), workMinute); platformDataListResponse.setFinishTime(overDate); } @@ -1926,12 +1932,12 @@ if(Objects.isNull(platformJob.getWorkNum()) || Objects.isNull(platformJob.getWorkRate())){ platformJob.setOptTime(0L); }else{ - Integer workMinute = platformJob.getWorkNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate()).intValue(); + Integer workMinute = platformJob.getWorkNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate(),0,BigDecimal.ROUND_HALF_UP).intValue(); Date overDate = DateUtil.getXMinuteAfterDate(platformJob.getNewStartDate(),workMinute); platformJob.setOptTime(overDate.getTime()); } }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())){ - platformJob.setOptTime(DateUtil.getXMinuteAfterDate(platformJob.getCallDate(),platformJob.getWorktimeOutAlarmTime()).getTime()); + platformJob.setOptTime(DateUtil.getXMinuteAfterDate(platformJob.getNewCallDate(),platformJob.getWorktimeOutAlarmTime()).getTime()); } } largeScreenDataVO.setAllList(platformJobList); @@ -1942,9 +1948,11 @@ return largeScreenDataVO; } - - + + /** + * 浣滀笟瀹屾垚瓒呮椂 + */ @Override public void timeOutReport(){ //鏌ヨ瓒呮椂鏁版嵁 @@ -1953,7 +1961,7 @@ .selectAs(Platform::getName,PlatformJob::getPlatformName) .select(" ( now() > DATE_ADD(t.DONE_DATE ,INTERVAL t1.STAY_TIMEOUT_ALARM_TIME MINUTE) ) as isTimeOut ") .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) - .in(PlatformJob::getStatus,Constants.PlatformJobStatus.DONE,Constants.PlatformJobStatus.AUTHED_LEAVE) + .in(PlatformJob::getStatus,Constants.PlatformJobStatus.DONE.getKey(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()) .eq(PlatformJob::getInOut,Constants.ONE) .isNotNull(PlatformJob::getDoneDate) ); @@ -1986,10 +1994,10 @@ List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>() .selectAll(PlatformJob.class) .selectAs(Platform::getName,PlatformJob::getPlatformName) - .select(" ( now() > DATE_ADD(t.CALL_DATE ,INTERVAL t2.WAIT_CALL_TIME MINUTE) ) as isTimeOut ") + .select(" ( now() > DATE_ADD( ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 4 order by pl.CREATE_DATE desc limit 1 ) ,INTERVAL t2.WAIT_CALL_TIME MINUTE) ) as isTimeOut ") .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId) - .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED) + .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey()) .isNotNull(PlatformJob::getCallDate) ); //濡傛灉瓒呮椂 澶勭悊鏁版嵁 骞跺彂閫乴ed涓庡箍鎾� @@ -2002,4 +2010,43 @@ } + /** + * 浣滀笟瓒呮椂 + */ + @Override + public void timeOutWork(){ + //鏌ヨ瓒呮椂鏁版嵁 + List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>() + .selectAll(PlatformJob.class) + .selectAs(Platform::getName,PlatformJob::getPlatformName) + .selectAs(Platform::getWorkRate, PlatformJob::getWorkRate) + .selectAs(Platform::getWorkTimeoutAlarmTime, PlatformJob::getWorktimeOutAlarmTime) + .select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end workNum ") + .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 5 order by pl.CREATE_DATE desc limit 1 ) as newStartDate ") + .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) + .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WORKING.getKey()) + .eq(PlatformJob::getInOut,Constants.ONE) + ); + //濡傛灉瓒呮椂 澶勭悊鏁版嵁 骞跺彂閫乴ed涓庡箍鎾� + for (PlatformJob platformJob:platformJobList) { + + Integer workMinute = platformJob.getWorkNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate(),0,BigDecimal.ROUND_HALF_UP).intValue(); + Date overDate = DateUtil.getXMinuteAfterDate(platformJob.getNewStartDate(),workMinute + platformJob.getWorktimeOutAlarmTime()); + if(overDate.getTime() < System.currentTimeMillis() ){ + //骞挎挱 led閫氱煡 + this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.TIMEOUT_WORK.getInfo(), + Constants.PlatformBroadcastContent.TIMEOUT_WORK.getInfo()); + + SavePlatformWarnEventDTO savePlatformWarnEventDTO = new SavePlatformWarnEventDTO(); + savePlatformWarnEventDTO.setPlatformJobId(platformJob.getId()); + savePlatformWarnEventDTO.setPlatformId(platformJob.getPlatformId()); + savePlatformWarnEventDTO.setCarCode(platformJob.getCarCodeFront()); + savePlatformWarnEventDTO.setEventType(Constants.PlatformWarnEvent.WORK_TIMEOUT.getKey()); + platformWarnEventService.savePlatformWarnEvent(savePlatformWarnEventDTO); + } + + } + } + + } -- Gitblit v1.9.3