From 112db9dc43275c991e824eba1abfeb37d9bab3a1 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 11 十月 2024 18:56:15 +0800 Subject: [PATCH] 代码初始化 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 65 +++++++++++++++++++++++++++----- 1 files changed, 54 insertions(+), 11 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..7bdf5a0 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 @@ -271,6 +271,7 @@ .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())) @@ -1093,7 +1094,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 +1171,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 +1733,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 +1928,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 +1944,11 @@ return largeScreenDataVO; } - - + + /** + * 浣滀笟瀹屾垚瓒呮椂 + */ @Override public void timeOutReport(){ //鏌ヨ瓒呮椂鏁版嵁 @@ -1953,7 +1957,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 +1990,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 +2006,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