From 7cdea6d16a8b9f74800792ea412ad8b51c4df7f4 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期二, 22 十月 2024 17:48:38 +0800 Subject: [PATCH] 最新版本541200007 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 101 insertions(+), 9 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java index c735509..23383bc 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java @@ -22,18 +22,20 @@ import com.doumee.dao.business.join.VisitsJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; +import com.doumee.service.business.PlatformJobService; import com.doumee.service.business.impl.PlatformWarnEventServiceImpl; import com.github.yulichang.wrapper.MPJLambdaWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.units.qual.C; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * 璁垮鏉冮檺缁勪俊鎭〃Service瀹炵幇 @@ -517,7 +519,8 @@ private Retention getRetentionModelByVisitRequest(Visits visits, String happentTime,String srcType) { Retention retention = new Retention(); retention.setIsdeleted(Constants.ZERO); - retention.setCreateDate(DateUtil.getISO8601DateByStr(happentTime)); + retention.setCreateDate(DateUtil.getISO8601DateByStr2(happentTime)); + retention.setCreateDate(retention.getCreateDate() == null?new Date():retention.getCreateDate()); retention.setClasses(visits.getClasses()); retention.setCode(visits.getCode()); retention.setIdcardNo(visits.getIdcardNo()); @@ -559,7 +562,8 @@ event.setStartTime(request.getData().getVisitorInvoices().getBeginTime()); event.setSrcType(request.getSrcType()); event.setSrcParentIndex(request.getSrcParentIndex()); - event.setSrcName(request.getSrcName()); + event.setSrcName((request.getData()!=null &&request.getData().getParamValues()!=null)? + request.getData().getParamValues().getSrcName():request.getSrcName()); event.setSrcIndex(request.getSrcIndex()); event.setSex(detail.getSex()); event.setPurpose(request.getData().getVisitorInvoices().getVisitReason()); @@ -822,6 +826,55 @@ .last("limit 1" )); if(cars!=null){ event.setMemberId(cars.getMemberId()); + //鑷湁杞� 鏌ヨ褰撳墠鏄惁鏈夊緟绛惧埌鐨勪换鍔� + if(carsMapper.selectCount(new QueryWrapper<Cars>() + .lambda().eq(Cars::getCode,event.getPlateNos()) + .eq(Cars::getType,Constants.ONE) + .eq(Cars::getIsdeleted,Constants.ZERO) + )>Constants.ZERO){ + //鏌ヨ杞﹁締褰撳墠鏄惁瀛樺湪杩涜涓殑浠诲姟 + if( platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda() + .eq(PlatformJob::getCarCodeFront,event.getPlateNos()) + .eq(PlatformJob::getIsdeleted,Constants.ZERO) + .in(PlatformJob::getStatus, + Constants.PlatformJobStatus.IN_WAIT.getKey(), + Constants.PlatformJobStatus.CALLED.getKey(), + Constants.PlatformJobStatus.WORKING.getKey(), + Constants.PlatformJobStatus.DONE.getKey(), + Constants.PlatformJobStatus.TRANSFERING.getKey(), + Constants.PlatformJobStatus.EXCEPTION.getKey(), + Constants.PlatformJobStatus.AUTHED_LEAVE.getKey() + ) + )==Constants.ZERO){ + PlatformJob platformJob = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda() + .eq(PlatformJob::getCarCodeFront,event.getPlateNos()) + .eq(PlatformJob::getIsdeleted,Constants.ZERO) + .in(PlatformJob::getStatus, + Constants.PlatformJobStatus.WAIT_CONFIRM.getKey(), + Constants.PlatformJobStatus.WART_SIGN_IN.getKey() + ) + .orderByAsc(PlatformJob::getCreateDate) + .last(" limit 1") + ); + if(Objects.nonNull(platformJob)){ + platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey()); + platformJob.setArriveDate(new Date()); + platformJob.setSingType(Constants.TWO); + platformJob.setSignDate(new Date()); + 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); + } + platformJobMapper.updateById(platformJob); + } + } + }; + + + }else{ Visits visits = visitsMapper.selectOne(new QueryWrapper<Visits>().lambda() .eq(Visits::getCarNos,event.getPlateNos()) @@ -973,6 +1026,7 @@ PlatformJob job = platformJobMapper.selectJoinOne(PlatformJob.class, new MPJLambdaWrapper<PlatformJob>() .selectAll(PlatformJob.class) .selectAs(Platform::getName,PlatformJob::getPlatformName) + .selectAs(Platform::getLedContent,PlatformJob::getLedContent) .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) // .eq(StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeFront,status.getPlateNo() )//鍓嶈溅鐗屽彿 // .eq(!StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeBack,status.getPlateNo() )//鍚庤溅鐗屽彿 @@ -1004,15 +1058,21 @@ update.setStatus(Constants.PlatformJobStatus.DONE.getKey());//浣滀笟宸插畬鎴� update.setDoneDate(update.getEditDate());*/ if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.DONE.getKey()) || + Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.TRANSFERING.getKey()) || + Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.EXCEPTION.getKey()) || Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey())){ if(((StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeFront(),status.getPlateNo())) ||(!StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeBack(),status.getPlateNo())) )){ //璇存槑杞﹁締杩涢敊鏈堝彴 鎴栬�呰繕鏈彨鍙风姸鎬侊紝鍙戣捣璀﹀憡 // dealCarsInErrorPlatformBiz(job,status); - update.setInOut(Constants.ZERO);//杞﹁締宸茬粡绂诲紑 - platformJobMapper.updateById(update); - } + if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.DONE.getKey()) || + Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey())){ + update.setInOut(Constants.ZERO);//杞﹁締宸茬粡绂诲紑 + platformJobMapper.updateById(update); + } + dealPlatformContentForLeave(job); + } } }else if(StringUtils.equals(status.getMotionStatus(),"enter")){ //濡傛灉鏄溅杈嗚繘鍏� @@ -1028,7 +1088,8 @@ platformJobMapper.updateById(update); } } - /*if(job.getStartDate() == null){ + /* + if(job.getStartDate() == null){ update.setStartDate(update.getEditDate()); } update.setStatus(Constants.PlatformJobStatus.WORKING.getKey());//寮�濮嬩綔涓� @@ -1054,6 +1115,37 @@ return null; } + /** + * 鏈堝彴杞﹁締绂诲紑 璁剧疆鏈堝彴鏂囨涓衡�滅┖闂蹭腑 鏂囨鈥� + * @param model + */ + private void dealPlatformContentForLeave(PlatformJob model) { + List<PlatformDevice> deviceList = platformDeviceMapper.selectList(new QueryWrapper<PlatformDevice>().lambda() + .eq(PlatformDevice::getType, Constants.ZERO) + .eq(PlatformDevice::getPlatformId,model.getPlatformId()) + .eq(PlatformDevice::getIsdeleted,Constants.ZERO)); + if(deviceList ==null || deviceList.size() == 0){ + return; + } + int speed = 13; + try { + speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode()); + }catch (Exception e){ + } + String content = StringUtils.defaultString(model.getLedContent(), Constants.PlatformLedContent.IDEL_CONTNET.getInfo()); + List<PlatformBroadcastLog> logList = new ArrayList<>(); + for(PlatformDevice device : deviceList){ + if(StringUtils.isBlank(device.getHkId())){ + continue; + } + PlatformBroadcastLog log = dealLedContentBiz(model.getId(),device.getHkNo(),device.getName(),content,speed,1); + logList.add(log); + } + if(logList.size()>0){ + platformBroadcastLogMapper.insert(logList); + } + } + private PlatformEvent initPlatformEventModel(EventPlatformCarsInfoRequest request, EventPlatformCarsDataRequest data, EventPlatformCarsStatusInfoRequest status) { PlatformEvent model = new PlatformEvent(); model.setCreateDate(new Date()); -- Gitblit v1.9.3