From 5c63d3fa13956182f999a02ebd291161cf1b32bc Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 03 一月 2025 18:22:42 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java | 240 ++++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 154 insertions(+), 86 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 45a748e..a3da3de 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
@@ -19,10 +19,11 @@
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
+import com.doumee.dao.business.dao.MemberMapper;
import com.doumee.dao.business.join.VisitsJoinMapper;
import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.model.Member;
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;
@@ -87,8 +88,13 @@
private PlatformLogMapper platformLogMapper;
@Autowired
private PlatformWarnEventServiceImpl platformWarnEventService;
- @Autowired
- private PlatformJobService platformJobService;
+
+
+
+
+
+
+
/**
* 娴峰悍闂ㄧ浜嬩欢鎺ㄩ��
* @param param
@@ -475,10 +481,12 @@
//濡傛灉鏄瀹㈢櫥璁帮紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰�
// retentionList.add(getRetentionModelByVisitRequest(visits, request.getHappenTime(),request.getSrcType()));
//鏉ヨ鏃堕棿
- inoutDayCount.setSigninVisitorNum(Constants.formatIntegerNum(inoutDayCount.getSigninVisitorNum())+1);
- updateVistis.setStatus(Constants.VisitStatus.signin);
- updateVistis.setInDate(DateUtil.getISO8601DateByStr(data.getBeginTime()));
- updateVistis.setOutDate(DateUtil.getISO8601DateByStr(data.getFinishTime()));
+ if(Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.xfSuccess)){
+ inoutDayCount.setSigninVisitorNum(Constants.formatIntegerNum(inoutDayCount.getSigninVisitorNum())+1);
+ updateVistis.setStatus(Constants.VisitStatus.signin);
+ updateVistis.setInDate(DateUtil.getISO8601DateByStr(data.getBeginTime()));
+ updateVistis.setOutDate(DateUtil.getISO8601DateByStr(data.getFinishTime()));
+ }
//鏇存柊鏈�鏂版潵璁挎椂闂�
Member member = new Member();
member.setLastVisitDate(updateVistis.getInDate());
@@ -486,12 +494,14 @@
memberMapper.updateById(member);
}else if (Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_ICCM_OUT.getKey()) {
//濡傛灉鏄瀹㈢绂讳簨浠�
- inoutDayCount.setLeaveVisitorNum(Constants.formatIntegerNum(inoutDayCount.getLeaveVisitorNum())+1);
- updateVistis.setStatus(Constants.VisitStatus.signout);
- updateVistis.setInDate(DateUtil.getISO8601DateByStr(data.getBeginTime()));
- updateVistis.setOutDate(DateUtil.getISO8601DateByStr(data.getFinishTime()));
- updateVistis.setOutType(Constants.ZERO);
- updateVistis.setOutInfo("璁垮姝e父绛剧");
+ if(Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.signin)){
+ inoutDayCount.setLeaveVisitorNum(Constants.formatIntegerNum(inoutDayCount.getLeaveVisitorNum())+1);
+ updateVistis.setStatus(Constants.VisitStatus.signout);
+ updateVistis.setInDate(DateUtil.getISO8601DateByStr(data.getBeginTime()));
+ updateVistis.setOutDate(DateUtil.getISO8601DateByStr(data.getFinishTime()));
+ updateVistis.setOutType(Constants.ZERO);
+ updateVistis.setOutInfo("璁垮姝e父绛剧");
+ }
}else{
//濡傛灉浜哄憳淇℃伅瀛樺湪锛屽垏鏄瀹㈤�氳锛屽垯鍒犻櫎涔嬪墠鐨勬墍鏈夎繘鍦烘暟鎹紙鏃犺姝ゆ鎺ㄩ�佹槸杩涘巶杩樻槸鍑哄満鎺ㄩ�佷簨浠讹級
delRetentionLis.add(visits.getMemberId());
@@ -520,7 +530,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());
@@ -562,7 +573,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());
@@ -819,81 +831,94 @@
event.setPlatePicUrl(getHkImgUrl(request.getData().getPicUrl().getPlatePicUrl()));
}
if(StringUtils.isNotBlank(event.getPlateNos())){
+ Cars carModel = carsMapper.selectJoinOne(Cars.class,new MPJLambdaWrapper<Cars>()
+ .selectAll(Cars.class )
+ .selectAs(Company::getType,Cars::getCompanyType)
+ .leftJoin(Company.class,Company::getId,Cars::getGroupId)
+ .eq(Cars::getCode,event.getPlateNos())
+ .eq(Cars::getIsdeleted,Constants.ZERO)
+ .last(" limit 1"));
+ if(carModel!=null){
+ //0瀹夋嘲鍏姟杞� 1瀹夋嘲鑷湁鐗╂祦杞� 2鍏跺畠
+ event.setMemberId(carModel.getMemberId());
+ event.setCompanyId(carModel.getGroupId());
+ if(Constants.equalsInteger(carModel.getType(),Constants.ONE)){
+ event.setCarType(Constants.RetentionCarType.selfTruck);
+ }else {
+ if(Constants.equalsInteger(carModel.getCompanyType(),Constants.ONE)){
+ event.setCarType(Constants.RetentionCarType.internal);//鍐呴儴杞﹁締
+ }else{
+ event.setCarType(Constants.RetentionCarType.relation);//鐩稿叧鏂硅溅杈�
+ }
+ }
+ }
+ PlatformJob carTypeJob = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda()
+ .eq(PlatformJob::getCarCodeFront,event.getPlateNos())
+ .eq(PlatformJob::getIsdeleted,Constants.ZERO)
+ .orderByAsc(PlatformJob::getCreateDate)
+ .last(" limit 1"));
+ if(carTypeJob!=null){
+ //浣滀笟绫诲瀷 0鑷湁杞﹀嵏璐� 1鑷湁杞﹁璐� 2澶栧崗杞﹀嵏璐� 3澶栧崗杞﹁璐� 4甯傚叕鍙稿鍗忚溅鍗歌揣
+ if(Constants.equalsInteger(carTypeJob.getType(),Constants.FOUR)){
+ event.setCarType(Constants.RetentionCarType.cityComTruck);//甯傚叕鍙歌溅杈�
+ }else if(Constants.equalsInteger(carTypeJob.getType(),Constants.TWO)
+ || Constants.equalsInteger(carTypeJob.getType(),Constants.THREE)){
+ event.setCarType(Constants.RetentionCarType.outTruck);//澶栧崗杞�
+ }else{
+ event.setCarType(Constants.RetentionCarType.selfTruck);//鑷湁杞�
+ }
+ }
+
ParkBook cars = parkBookMapper.selectOne(new QueryWrapper<ParkBook>().lambda()
.eq(ParkBook::getCarCode,event.getPlateNos())
.eq(ParkBook::getIsdeleted,Constants.ZERO )
.last("limit 1" ));
if(cars!=null){
event.setMemberId(cars.getMemberId());
-
- if(Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.PARK_PASS_IN.getKey()){
- 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 if(Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.PARK_PASS_OUT.getKey()){
- //绂诲満鍒ゆ柇鏄惁瀛樺湪鏈鍦虹殑璁㈠崟鏁版嵁 澶勭悊璁㈠崟鏁版嵁
- List<PlatformJob> platformJobList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda()
+ //鑷湁杞� 鏌ヨ褰撳墠鏄惁鏈夊緟绛惧埌鐨勪换鍔�
+ 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.TRANSFERING.getKey(),
+ Constants.PlatformJobStatus.EXCEPTION.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.DONE.getKey(),
- Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()
- ));
- if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformJobList)){
- for (PlatformJob platformJob:platformJobList) {
- platformJob.setStatus(Constants.PlatformJobStatus.LEAVED.getKey());
- platformJob.setOutDate(new Date());
- platformJob.setEditDate(new Date());
- platformJob.setOutType(Constants.ZERO);
- platformJobMapper.updateById(platformJob);
- //娓呯┖鎺堟潈
- platformJobService.cancelInPark(platformJob);
+ 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())
@@ -905,12 +930,13 @@
if(visits!=null){
//鏈�杩戜娇鐢ㄨ杞︾殑鐢宠浜猴紙宸插埌杈撅級
event.setMemberId(visits.getMemberId());
+ event.setCarType(Constants.RetentionCarType.visitor);
}
}
if(Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.PARK_PASS_IN.getKey()){
//濡傛灉鏄叆鍘傛斁琛�
delRetentionList.add(event.getPlateNos());
- retentionList.add(getRetentionModelByParkRequest(request));
+ retentionList.add(getRetentionModelByParkRequest(request,event));
inoutDayCount.setInCarNum(Constants.formatIntegerNum(inoutDayCount.getInCarNum())+1);
}else if(Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.PARK_PASS_OUT.getKey()){
//濡傛灉鏄嚭鍦烘斁琛�
@@ -921,12 +947,15 @@
return event;
}
- private Retention getRetentionModelByParkRequest(EventParkInfoRequest request) {
+ private Retention getRetentionModelByParkRequest(EventParkInfoRequest request,CarEvent event) {
Retention retention = new Retention();
retention.setIsdeleted(Constants.ZERO);
retention.setCreateDate(DateUtil.getISO8601DateByStr(request.getHappenTime()));
retention.setCarNo(request.getData().getPlateNo());
retention.setType(Constants.THREE);
+ retention.setMemberId(event.getMemberId());
+ retention.setCarType(event.getCarType());
+ retention.setCompanyId(event.getCompanyId());
// retention.setDeviceName(request.getSrcName());
// retention.setDeviceIndex(request.getSrcIndex());
return retention;
@@ -1045,6 +1074,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() )//鍚庤溅鐗屽彿
@@ -1076,15 +1106,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")){
//濡傛灉鏄溅杈嗚繘鍏�
@@ -1100,7 +1136,8 @@
platformJobMapper.updateById(update);
}
}
- /*if(job.getStartDate() == null){
+ /*
+ if(job.getStartDate() == null){
update.setStartDate(update.getEditDate());
}
update.setStatus(Constants.PlatformJobStatus.WORKING.getKey());//寮�濮嬩綔涓�
@@ -1124,6 +1161,37 @@
saveInterfaceLog(param,"/business/hksync/push/platform/workstatus",result,false);//涓嶈鏃ュ織
}
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) {
@@ -1243,12 +1311,12 @@
if(StringUtils.isBlank(device.getHkId())){
continue;
}
- if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
+ /*if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
//濡傛灉鏄疞ED
PlatformBroadcastLog log = dealLedContentBiz(model.getId(),device.getHkNo(),device.getName(),content,speed,1);
logList.add(log);
ledList.add(device.getHkId());
- }else if(Constants.equalsInteger(device.getType(),Constants.TWO)){
+ }else */if(Constants.equalsInteger(device.getType(),Constants.TWO)){
//濡傛灉鏄箍鎾偣
bNames += device.getName()+";";
broadcastList.add(device.getHkId());
--
Gitblit v1.9.3