From 21ffb032824db3c392f63d318d36efee33326b80 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 26 二月 2025 09:17:15 +0800 Subject: [PATCH] 最新版本541200007 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 112 ++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 73 insertions(+), 39 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 ea52c99..eb84711 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 @@ -10,7 +10,7 @@ import com.doumee.core.haikang.model.param.request.ParkReservationDelRequest; import com.doumee.core.haikang.model.param.respose.ParkReservationAddResponse; import com.doumee.core.haikang.service.HKService; -import com.doumee.service.business.third.WmsService; +import com.doumee.dao.business.dao.UserActionMapper; import com.doumee.service.business.third.model.LoginUserInfo; import com.doumee.service.business.third.model.PageData; import com.doumee.service.business.third.model.PageWrap; @@ -75,6 +75,8 @@ @Autowired private PlatformJobMapper platformJobMapper; + @Autowired + private UserActionMapper userActionMapper; @Autowired private TmsService tmsService; @@ -147,6 +149,30 @@ @Override + @Transactional(rollbackFor = {BusinessException.class}) + public void deleteById(Integer id,LoginUserInfo user) { + Date date = new Date(); + PlatformJob job = platformJobMapper.selectById(id); + if(job==null ||Constants.equalsInteger(Constants.ONE,job.getIsdeleted())){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(! Constants.equalsInteger(Constants.PlatformJobStatus.CANCEL.getKey(),job.getStatus())){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍙兘鍒犻櫎宸插彇娑堢殑浣滀笟浠诲姟锛�"); + } + platformJobMapper.update(null,new UpdateWrapper<PlatformJob>().lambda() + .set(PlatformJob::getIsdeleted,Constants.ONE) + .set(PlatformJob::getEditDate,date) + .set(PlatformJob::getEditor,user.getId()) + .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CANCEL.getKey()) + .eq(PlatformJob::getId,id)); + String[] params = new String[3]; + params[0] = user.getRealname(); + params[1]=DateUtil.getPlusTime2(date); + params[2]=job.getBillCode()+"-銆愬徃鏈猴細"+job.getDriverName()+" "+job.getDrivierPhone()+"銆�-銆愯溅鐗屽彿锛�"+job.getCarCodeFront()+"銆�"; + //璁板綍鍒犻櫎鏃ュ織 + UserActionServiceImpl.saveUserActionBiz(user,id,Constants.UserActionType.PLATFROM_JOB_DEL,userActionMapper,date,params,JSONObject.toJSONString(job)); + } + @Override public void delete(Integer id) { platformJobMapper.update(null,new UpdateWrapper<PlatformJob>().lambda() .set(PlatformJob::getIsdeleted,Constants.ONE) @@ -205,6 +231,7 @@ IPage<PlatformJob> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); MPJLambdaWrapper<PlatformJob> queryWrapper = new MPJLambdaWrapper<>(); Utils.MP.blankToNull(pageWrap.getModel()); + pageWrap.getModel().setIsdeleted(Constants.ZERO); queryWrapper .selectAll(PlatformJob.class) .selectAs(Platform::getName,PlatformJob::getPlatformName) @@ -297,13 +324,13 @@ .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().getCreateDateStart() != null, PlatformJob::getCreateDate, pageWrap.getModel().getCreateDateStart()) + .le(pageWrap.getModel().getCreateDateEnd() != null, PlatformJob::getCreateDate, pageWrap.getModel().getCreateDateEnd()) .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())) .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) .exists(StringUtils.isNotBlank(pageWrap.getModel().getWmsContractNum()), @@ -346,15 +373,12 @@ .apply("( t1.isdeleted = 0 or t.PLATFORM_ID is null )") .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId()) .like(pageWrap.getModel().getCarCodeFront() != null, PlatformJob::getCarCodeFront, pageWrap.getModel().getCarCodeFront()) - .apply(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE), " ( " + " ( t.`STATUS` = "+Constants.PlatformJobStatus.WAIT_CALL.getKey()+" and t.PLATFORM_GROUP_ID = ( SELECT p.group_id FROM platform p WHERE p.id = "+pageWrap.getModel().getPlatformId()+" LIMIT 1 ) )" + ") " ) - - .apply(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.TWO), " ( " + @@ -365,8 +389,6 @@ " (t.`STATUS` = "+Constants.PlatformJobStatus.TRANSFERING.getKey()+" and t.PLATFORM_ID = "+pageWrap.getModel().getPlatformId()+" ) " + ") " ) - - .and(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.THREE), i->i.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()).or() @@ -428,8 +450,6 @@ } } } - - public void queryWaitNum(PlatformJob platformJob){ if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())){ //鏌ヨ褰撳墠鎵�鏈夋帓闃熸暟閲� @@ -442,11 +462,10 @@ .eq(PlatformJob::getPlatformGroupId,platformJob.getPlatformGroupId()) // .like(PlatformJob::getArriveDate,DateUtil.dateTypeToString(platformJob.getArriveDate(),"yyyy-MM-dd")) ); - - for (PlatformJob linePlatformJob:lineUpAllList) { - this.getWmsJobData(linePlatformJob); - } if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(lineUpAllList)){ + for (PlatformJob linePlatformJob:lineUpAllList) { + this.getWmsJobData(linePlatformJob); + } //鏌ヨ鎺掗槦鍦ㄦ垜鍓嶉潰鐨勬暟鎹� List<PlatformJob> lineUpNum = lineUpAllList.stream().filter(i->Objects.nonNull(i.getSignDate())&&i.getSignDate().getTime()<platformJob.getSignDate().getTime()).collect(Collectors.toList()); platformJob.setLineUpNum(lineUpNum.size()); @@ -457,7 +476,10 @@ //璁$畻棰勮绛夊緟鏃堕棿 List<Platform> platformList = platformJoinMapper.selectList(new QueryWrapper<Platform>().lambda() .eq(Platform::getIsdeleted,Constants.ZERO).eq(Platform::getGroupId,platformJob.getPlatformGroupId())); - BigDecimal workRate = platformList.stream().map(m->m.getWorkRate()).reduce(BigDecimal.ZERO,BigDecimal::add); + BigDecimal workRate = new BigDecimal(0); + if(platformList!=null){ + workRate = platformList.stream().map(m->Constants.formatBigdecimal(m.getWorkRate())).reduce(BigDecimal.ZERO,BigDecimal::add); + } if(sumWorkRate.compareTo(BigDecimal.ZERO) > Constants.ZERO && workRate.compareTo(BigDecimal.ZERO) > Constants.ZERO ){ BigDecimal sumMinute = sumWorkRate.divide(workRate,1, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(60L)); Integer sumMinuteInteger = sumMinute.intValue(); @@ -476,7 +498,9 @@ platformJob.setWaitTime("棰勮绛夊緟锛�-灏忔椂-鍒嗛挓"); } }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey()) - || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){ + || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey()) + || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()) + || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.LEAVED.getKey())){ //鏌ヨ鏈�鍚庡紑濮嬩换鍔$殑鏈堝彴璁板綍 鏃ュ織琛� 鍥犱负瀛樺湪寮傚父鎸傝捣 杞Щ 绛夐棶棰� PlatformLog platformLog = platformLogMapper.selectOne(new QueryWrapper<PlatformLog>().lambda() .eq(PlatformLog::getJobId,platformJob.getId()) @@ -484,7 +508,7 @@ .orderByDesc(PlatformLog::getCreateDate) .last(" limit 1") ); - if(Objects.nonNull(platformLog)){ + if(Objects.nonNull(platformLog) && platformJob.getWorkRate()!=null && platformJob.getWorkRate().compareTo(new BigDecimal(0))>0){ BigDecimal sumMinute = platformJob.getTotalNum().divide(platformJob.getWorkRate(),1, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(60L)); platformJob.setFinishTimeStr(DateUtil.DateToStr(DateUtil.afterMinutesDate(platformLog.getCreateDate(),sumMinute.intValue()),"HH:mm")); } @@ -494,9 +518,12 @@ .isNotNull(PlatformLog::getParam3) .ne(PlatformLog::getParam3,Constants.ZERO+"") .orderByDesc(PlatformLog::getCreateDate)); - platformJob.setWorkTime(platformLogList.stream().map(m->Long.valueOf(m.getParam3())).reduce(Long.valueOf(0),Long::sum)); + if(platformLogList!=null){ + platformJob.setWorkTime(platformLogList.stream().map(m->Long.valueOf(StringUtils.defaultString(m.getParam3(),"0"))).reduce(Long.valueOf(0),Long::sum)); + } } + platformJob.setWorkTimeStr(DateUtil.getTimeStrBySecond(platformJob.getWorkTime())); } @@ -534,7 +561,6 @@ //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺 this.queryWaitNum(platformJob); } - driverHomeVO.setPlatformJobList(platformJobList); // 鍥尯瀵艰鍥� 鍥剧墖 driverHomeVO.setReservationMap(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.PLATFORM_GUIDEMAP).getCode()); @@ -601,11 +627,17 @@ BeanUtils.copyProperties(platformJob,oldPlatformJob); if(Constants.equalsInteger(signInDTO.getSignType(),Constants.ZERO)){ + if(!StringUtils.equals(platformJob.getDrivierPhone(),signInDTO.getLoginUserInfo().getMobile())){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅"); } this.distanceSignIn(signInDTO,platformJob); }else if(Constants.equalsInteger(signInDTO.getSignType(),Constants.ONE)){ + if(!StringUtils.equals(platformJob.getDrivierPhone(),signInDTO.getLoginUserInfo().getMobile())){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅"); } @@ -653,7 +685,6 @@ || Objects.isNull(signInDTO.getLnt())){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"缁忕含搴︿俊鎭紓甯�"); } - //鑾峰彇绛惧埌鐐圭殑缁忕含搴� Double lat = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LAT).getCode()); Double lnt = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LNT).getCode()); @@ -678,11 +709,9 @@ } } - @Override public PlatformJob getDetail(JobDetailDTO jobDetailDTO){ - if(Objects.isNull(jobDetailDTO) - || Objects.isNull(jobDetailDTO.getJobId())){ + if(Objects.isNull(jobDetailDTO) || Objects.isNull(jobDetailDTO.getJobId())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } PlatformJob platformJob = platformJobMapper.selectById(jobDetailDTO.getJobId()); @@ -692,14 +721,16 @@ if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){ //寰呯鍒� 璁$畻璺濈 if(Objects.nonNull(jobDetailDTO.getLnt())&&Objects.nonNull(jobDetailDTO.getLat())){ - //鑾峰彇绛惧埌鐐圭殑缁忕含搴� - Double lat = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LAT).getCode()); - Double lnt = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LNT).getCode()); - //鑾峰彇2涓偣鐨勮窛绂籜绫� - Double getDistanceDouble = PositionUtil.getDistance(jobDetailDTO.getLnt(),jobDetailDTO.getLat(),lnt,lat); - //杞崲km - BigDecimal getDistance = BigDecimal.valueOf(getDistanceDouble).divide(new BigDecimal(1000),2,BigDecimal.ROUND_HALF_UP); - platformJob.setGetDistance(getDistance); + if(jobDetailDTO.getLat()!=null && jobDetailDTO.getLnt()!=null){ + //鑾峰彇绛惧埌鐐圭殑缁忕含搴� + Double lat = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LAT).getCode()); + Double lnt = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LNT).getCode()); + //鑾峰彇2涓偣鐨勮窛绂籜绫� + Double getDistanceDouble = PositionUtil.getDistance(jobDetailDTO.getLnt(),jobDetailDTO.getLat(),lnt,lat); + //杞崲km + BigDecimal getDistance = BigDecimal.valueOf(getDistanceDouble).divide(new BigDecimal(1000),2,BigDecimal.ROUND_HALF_UP); + platformJob.setGetDistance(getDistance); + } } }else if( Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey()) || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.IN_WAIT.getKey()) @@ -887,7 +918,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())) { + if(Objects.nonNull(platformJob.getDrivierPhone())) { this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobCallIn,platformJob); } return platformJob; @@ -896,7 +927,7 @@ public void sendWxNotice(String objCode,PlatformJob platformJob){ SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() .eq(SystemUser::getDeleted, Constants.ZERO) - .eq(SystemUser::getType, Constants.ZERO) + .in(SystemUser::getType, Constants.ZERO,Constants.TWO) .eq(SystemUser::getMobile,platformJob.getDrivierPhone()) .last(" limit 1 ")); if (Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())) { @@ -1138,7 +1169,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())){ + if(Objects.nonNull(platformJob.getDrivierPhone())){ this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobSingIn,platformJob); } @@ -1274,7 +1305,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())) { + if(Objects.nonNull(platformJob.getDrivierPhone())) { this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobMove,platformJob); } @@ -1327,7 +1358,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())){ + if(Objects.nonNull(platformJob.getDrivierPhone())){ this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobOverNum,platformJob); } @@ -1379,7 +1410,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())) { + if(Objects.nonNull(platformJob.getDrivierPhone())) { this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobError,platformJob); } @@ -1433,7 +1464,7 @@ SmsConstants.platformJobContent.platformJobWorking,platform.getName(),null ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())) { + if(Objects.nonNull(platformJob.getDrivierPhone())) { this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobWorking,platformJob); } //骞挎挱 led閫氱煡 @@ -1534,7 +1565,7 @@ ); //鍏紬鍙锋ā鏉挎秷鎭� - if(Objects.nonNull(platformJob.getDriverId())) { + if(Objects.nonNull(platformJob.getDrivierPhone())) { this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobFinish,platformJob); } @@ -2195,8 +2226,11 @@ List<PlatformJob> calledList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList()); largeScreenDataVO.setWaitWorkList(calledList); } +// String u = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.BIGSCREEN_UUID); +// if(StringUtils.isBlank(u)){ String u = UUID.randomUUID().toString(); redisTemplate.opsForValue().set(Constants.RedisKeys.BIGSCREEN_UUID,u,3, TimeUnit.MINUTES); +// } String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),Constants.WxUrlParams.BISCREEN_CODE,u); largeScreenDataVO.setQrCode(url); largeScreenDataVO.setAttention(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_ATTENTION).getCode()); -- Gitblit v1.9.3