From 2d2ac91d76af6ef4d755555c7623ee4e016a3066 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期日, 29 九月 2024 15:50:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 107 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 90 insertions(+), 17 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 7dcc323..5d37270 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 @@ -22,6 +22,7 @@ import com.doumee.dao.business.join.PlatformJobJoinMapper; import com.doumee.dao.business.join.PlatformJoinMapper; import com.doumee.dao.business.model.*; +import com.doumee.dao.business.vo.LargeScreenDataVO; import com.doumee.dao.openapi.request.*; import com.doumee.dao.openapi.response.*; import com.doumee.dao.system.model.SystemUser; @@ -45,10 +46,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -174,7 +172,8 @@ .selectAs(PlatformGroup::getName,PlatformJob::getPlatformGroupName) .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate) .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName) - .selectAs(SystemUser::getUsername,PlatformJob::getOutUserName) + .selectAs(PlatformWmsJob::getIoCreatedate,PlatformJob::getIoCreatedate) + .selectAs(SystemUser::getRealname,PlatformJob::getOutUserName) .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId) .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode) @@ -202,6 +201,7 @@ .eq(pageWrap.getModel().getSingType() != null, PlatformJob::getSingType, pageWrap.getModel().getSingType()) .eq(pageWrap.getModel().getSignDistance() != null, PlatformJob::getSignDistance, pageWrap.getModel().getSignDistance()) .eq(pageWrap.getModel().getPlatformNames() != null, PlatformJob::getPlatformNames, pageWrap.getModel().getPlatformNames()) + .like(pageWrap.getModel().getPlatformName() != null, Platform::getName, pageWrap.getModel().getPlatformName()) .eq(pageWrap.getModel().getPlatforms() != null, PlatformJob::getPlatforms, pageWrap.getModel().getPlatforms()) .eq(pageWrap.getModel().getPlatformId() != null, PlatformJob::getPlatformId, pageWrap.getModel().getPlatformId()) .ge(pageWrap.getModel().getInwaitDate() != null, PlatformJob::getInwaitDate, Utils.Date.getStart(pageWrap.getModel().getInwaitDate())) @@ -254,6 +254,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().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())) @@ -288,17 +289,15 @@ Utils.MP.blankToNull(pageWrap.getModel()); queryWrapper .selectAll(PlatformJob.class) + .selectAs(PlatformBooks::getId,PlatformJob::getBookId) .selectAs(Platform::getName,PlatformJob::getPlatformName) .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate) .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName) .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode) + .leftJoin(PlatformBooks.class,PlatformBooks::getJobId,PlatformJob::getId) .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId()) .like(pageWrap.getModel().getCarCodeFront() != null, PlatformJob::getCarCodeFront, pageWrap.getModel().getCarCodeFront()) -// .eq(Objects.nonNull(pageWrap.getModel().getCallType()) -// &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE), -// PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey() -// ) .apply(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE), @@ -324,7 +323,7 @@ &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.THREE), i->i.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()).or() .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.IN_WAIT.getKey()).or() - .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey()).or() +// .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey()).or() .apply(" ( t.status = "+Constants.PlatformJobStatus.TRANSFERING.getKey()+" and t.PLATFORM_GROUP_ID = "+pageWrap.getModel().getPlatformGroupId()+" ) ") ) // .like(PlatformJob::getArriveDate,DateUtil.dateTypeToString(new Date(),"yyyy-MM-dd")) @@ -549,6 +548,23 @@ }else{ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"绛惧埌绫诲瀷閿欒"); } + //鏌ヨ鏈堝彴缁勬暟鎹� + PlatformGroup platformGroup = platformGroupMapper.selectById(platformJob.getPlatformGroupId()); + if(Objects.isNull(platformGroup)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏈堝彴缁勪俊鎭�"); + } + if(System.currentTimeMillis() > DateUtil.getDateByString(DateUtil.getCurrDate() + " " + platformGroup.getEndTime() + ":59" ).getTime() + || System.currentTimeMillis() < DateUtil.getDateByString(DateUtil.getCurrDate() + " " + platformGroup.getStartTime() + ":00" ).getTime()){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈湪宸ヤ綔鏃堕棿["+platformGroup.getStartTime() + "-" + platformGroup.getEndTime() +"]锛屾棤娉曡繘琛岀鍒�"); + } + //鏌ヨ浠婃棩鏈�澶х殑绛惧埌鏁� + List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda().apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null ")); + if(CollectionUtils.isEmpty(signList)){ + platformJob.setSignNum(Constants.ONE); + } else{ + int maxNumber = Collections.max(signList.stream().map(i->i.getSignNum()).collect(Collectors.toList())); + platformJob.setSignNum(maxNumber + Constants.ONE); + } platformJob.setSignDate(new Date()); platformJob.setSingType(signInDTO.getSignType()); platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey()); @@ -616,13 +632,16 @@ ){ //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺 this.queryWaitNum(platformJob); + Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId()); + if(Objects.nonNull(platform)){ + platformJob.setPlatformName(platform.getName()); + } }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){ //浣滀笟鏈堝彴淇℃伅 Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId()); if(Objects.nonNull(platform)){ platformJob.setPlatformName(platform.getName()); } - } platformJob.dealTime(); this.getWorkTime(platformJob); @@ -831,10 +850,10 @@ ParkReservationAddResponse parkReservationAddResponse = (ParkReservationAddResponse) response.getData(); visitPark.setHkId(parkReservationAddResponse.getReserveOrderNo()); visitPark.setHkStatus(Constants.ONE); - visitPark.setRemark("鍖呮湡鎴愬姛"); + visitPark.setRemark("杞﹁締鏉冮檺涓嬪彂鎴愬姛"); }else{ visitPark.setHkStatus(Constants.TWO); - visitPark.setRemark("鍖呮湡澶辫触~"); + visitPark.setRemark("杞﹁締鏉冮檺涓嬪彂澶辫触~"); //涓嬪彂澶辫触 鏍囪涓讳笟鍔$姸鎬佷负涓嬪彂澶辫触 sendStatus = false; } @@ -916,7 +935,7 @@ if(platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda() .eq(PlatformJob::getPlatformId,platform.getId()) .in(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey(),Constants.PlatformJobStatus.WORKING.getKey()) - )>platform.getWorkingNum()){ + )>=platform.getWorkingNum()){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瓒呭嚭鏈堝彴鍙悓鏃朵綔涓氭暟閲廩"+platform.getWorkingNum()+"杈哴"); }; @@ -1115,7 +1134,8 @@ if(Objects.isNull(platformJob)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } - if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){ + if(! (Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey()) + ||Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.EXCEPTION.getKey()) )){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�"); } PlatformJob oldPlatformJob = new PlatformJob(); @@ -1145,7 +1165,7 @@ */ @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) - public void powerLevel(JobOperateDTO jobOperateDTO){ + public PlatformJob powerLevel(JobOperateDTO jobOperateDTO){ if(Objects.isNull(jobOperateDTO) || Objects.isNull(jobOperateDTO.getJobId())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); @@ -1163,11 +1183,16 @@ platformJob.setOutHkdate(new Date()); platformJob.setStatus(Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()); platformJob.setEditDate(new Date()); + platformJob.setRemark(jobOperateDTO.getRemark()); platformJobMapper.updateById(platformJob); //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.AUTHED_LEAVE.getKey(),oldPlatformJob,platformJob , Constants.PlatformJobLogType.AUTHED_LEAVE.getInfo()); - //TODO 鎺堟潈杞﹁締绂诲満鏉冮檺 + return platformJob; + + + + } @@ -1272,6 +1297,7 @@ platformLog.setParam2(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); String v = Long.toString((platformLog.getCreateDate().getTime() - DateUtil.StringToDate(lastBeginPlatform.getParam1(),"yyyy-MM-dd HH:mm:ss").getTime() )/ 1000) ; platformLog.setParam3(v); + platformLog.setRemark(platformJobBefor.getPlatformId().toString()); }else{ platformLog.setParam3("0"); } @@ -1299,6 +1325,7 @@ platformLog.setParam2(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); String v = Long.toString((platformJobAfter.getDoneDate().getTime() - DateUtil.StringToDate(lastBeginPlatform.getParam1(),"yyyy-MM-dd HH:mm:ss").getTime()) / 1000) ; platformLog.setParam3(v); + platformLog.setRemark(platformJobBefor.getPlatformId().toString()); } }else if(Constants.equalsInteger(objType,Constants.PlatformJobLogType.WORKING.getKey())){ platformLog.setParam1(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); @@ -1646,5 +1673,51 @@ } + @Override + public LargeScreenDataVO getLargeScreenData(){ + LargeScreenDataVO largeScreenDataVO = new LargeScreenDataVO(); + List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>() + .selectAll(PlatformJob.class) + .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate) + .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 ") + .select(" ( 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 ) as newCallDate ") + .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) + .in(PlatformJob::getStatus, + Constants.PlatformJobStatus.WAIT_CALL.getKey(), + Constants.PlatformJobStatus.WORKING.getKey(), + Constants.PlatformJobStatus.CALLED.getKey(), + Constants.PlatformJobStatus.IN_WAIT.getKey() + ) + .orderByDesc(PlatformJob::getStatus) + .orderByAsc(PlatformJob::getSignDate) + ); + if(CollectionUtils.isEmpty(platformJobList)){ + for (PlatformJob platformJob:platformJobList) { + if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){ + //璁$畻宸蹭綔涓氭椂闀� 鏍规嵁鏈堝彴宸ヤ綔鏁堢巼 璁$畻浠诲姟閲忛渶瑕佹椂闂� + if(Objects.isNull(platformJob.getTotalNum()) || Objects.isNull(platformJob.getWorkRate())){ + platformJob.setOptTime(0L); + }else{ + Integer workMinute = platformJob.getTotalNum().multiply(new BigDecimal(60)).divide(platformJob.getWorkRate()).intValue(); + Date overDate = DateUtil.getXMinuteAfterDate(platformJob.getNewStartDate(),workMinute); + platformJob.setOptTime(overDate.getTime()/1000); + } + }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())){ + //璁$畻宸插彨鍙锋椂闂� + platformJob.dealTime(); + } + } + largeScreenDataVO.setAllList(platformJobList); + List<PlatformJob> calledList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList()); + largeScreenDataVO.setWaitWorkList(calledList); + } + largeScreenDataVO.setQrCode(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode()); + return largeScreenDataVO; + + } + + + + } -- Gitblit v1.9.3