From 0ddf64959252ef28c6050bbe0c0c64f99468ed25 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 18 十月 2024 11:21:40 +0800 Subject: [PATCH] 代码初始化 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java | 159 ++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 120 insertions(+), 39 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 99d6c49..45a748e 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,6 +22,7 @@ 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; @@ -29,11 +30,11 @@ 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瀹炵幇 @@ -86,6 +87,8 @@ private PlatformLogMapper platformLogMapper; @Autowired private PlatformWarnEventServiceImpl platformWarnEventService; + @Autowired + private PlatformJobService platformJobService; /** * 娴峰悍闂ㄧ浜嬩欢鎺ㄩ�� * @param param @@ -133,6 +136,7 @@ dealInoutDayCountBiz(inoutDayCount); log.info("銆愭捣搴烽棬绂佷簨浠舵帹閫併��========鎴愬姛======="); }catch (Exception e) { + e.printStackTrace(); log.error("銆愭捣搴烽棬绂佷簨浠舵帹閫併��========澶辫触=======锛歕n" + e.getMessage()); }finally { saveInterfaceLog(param,"/business/hksync/push/acs",result,false);//涓嶈鏃ュ織 @@ -142,11 +146,15 @@ } private void dealInoutDayCountBiz(InoutDayCount param) { + if(param == null){ + param = new InoutDayCount(); + } param.setTimeInfo(Utils.Date.getStart(new Date())); InoutDayCount model = inoutDayCountMapper.selectOne(new QueryWrapper<InoutDayCount>().lambda() .eq(InoutDayCount::getTimeInfo,param.getTimeInfo()) .eq(InoutDayCount::getIsdeleted,Constants.ZERO) .last("limit 1")); + log.error("============================inoutDayCountMapper:"+JSONObject.toJSONString(param)); if(model == null){ param.setIsdeleted(Constants.ZERO); param.setCreateDate(new Date()); @@ -156,18 +164,18 @@ inoutDayCountMapper.update(null,new UpdateWrapper<InoutDayCount>().lambda() .eq(InoutDayCount::getId,model.getId() ) .set(InoutDayCount::getEditDate,new Date() ) - .setSql(param.getInCarNum()!=null,"IN_CAR_NUM = ifnull(IN_CAR_NUM)"+param.getInCarNum() ) - .setSql(param.getOutCarNum()!=null,"OUT_CAR_NUM = ifnull(OUT_CAR_NUM)"+param.getOutCarNum() ) - .setSql(param.getInMemberNum()!=null,"IN_MEMBER_NUM = ifnull(IN_MEMBER_NUM)"+param.getInMemberNum() ) - .setSql(param.getOutMemberNum()!=null,"OUT_MEMBER_NUM = ifnull(OUT_MEMBER_NUM)"+param.getOutMemberNum() ) - .setSql(param.getInVisitorNum()!=null,"IN_VISITOR_NUM = ifnull(IN_VISITOR_NUM)"+param.getInVisitorNum() ) - .setSql(param.getOutVisitorNum()!=null,"OUT_VISITOR_NUM = ifnull(OUT_VISITOR_NUM)"+param.getOutVisitorNum() ) - .setSql(param.getSigninVisitorNum()!=null,"SIGNIN_VISITOR_NUM = ifnull(SIGNIN_VISITOR_NUM)"+param.getSigninVisitorNum() ) - .setSql(param.getLeaveVisitorNum()!=null,"LEAVE_VISITOR_NUM = ifnull(LEAVE_VISITOR_NUM)"+param.getLeaveVisitorNum() ) - .setSql(param.getInOtherMemberNum()!=null,"IN_OTHER_MEMBER_NUM = ifnull(IN_OTHER_MEMBER_NUM)"+param.getInOtherMemberNum() ) - .setSql(param.getOutOtherMemberNum()!=null,"OUT_OTHER_MEMBER_NUM = ifnull(OUT_OTHER_MEMBER_NUM)"+param.getOutOtherMemberNum() ) - .setSql(param.getInSelfMemberNum()!=null,"IN_SELF_MEMBER_NUM = ifnull(IN_SELF_MEMBER_NUM)"+param.getInSelfMemberNum() ) - .setSql(param.getOutSelfMemberNum()!=null,"OUT_SELF_MEMBER_NUM = ifnull(OUT_SELF_MEMBER_NUM)"+param.getOutSelfMemberNum() ) + .setSql(param.getInCarNum()!=null,"IN_CAR_NUM = ifnull(IN_CAR_NUM,0)+"+param.getInCarNum() ) + .setSql(param.getOutCarNum()!=null,"OUT_CAR_NUM = ifnull(OUT_CAR_NUM,0)+"+param.getOutCarNum() ) + .setSql(param.getInMemberNum()!=null,"IN_MEMBER_NUM = ifnull(IN_MEMBER_NUM,0)+"+param.getInMemberNum() ) + .setSql(param.getOutMemberNum()!=null,"OUT_MEMBER_NUM = ifnull(OUT_MEMBER_NUM,0)+"+param.getOutMemberNum() ) + .setSql(param.getInVisitorNum()!=null,"IN_VISITOR_NUM = ifnull(IN_VISITOR_NUM,0)+"+param.getInVisitorNum() ) + .setSql(param.getOutVisitorNum()!=null,"OUT_VISITOR_NUM = ifnull(OUT_VISITOR_NUM,0)+"+param.getOutVisitorNum() ) + .setSql(param.getSigninVisitorNum()!=null,"SIGNIN_VISITOR_NUM = ifnull(SIGNIN_VISITOR_NUM,0)+"+param.getSigninVisitorNum() ) + .setSql(param.getLeaveVisitorNum()!=null,"LEAVE_VISITOR_NUM = ifnull(LEAVE_VISITOR_NUM,0)+"+param.getLeaveVisitorNum() ) + .setSql(param.getInOtherMemberNum()!=null,"IN_OTHER_MEMBER_NUM = ifnull(IN_OTHER_MEMBER_NUM,0)+"+param.getInOtherMemberNum() ) + .setSql(param.getOutOtherMemberNum()!=null,"OUT_OTHER_MEMBER_NUM = ifnull(OUT_OTHER_MEMBER_NUM,0)+"+param.getOutOtherMemberNum() ) + .setSql(param.getInSelfMemberNum()!=null,"IN_SELF_MEMBER_NUM = ifnull(IN_SELF_MEMBER_NUM,0)+"+param.getInSelfMemberNum() ) + .setSql(param.getOutSelfMemberNum()!=null,"OUT_SELF_MEMBER_NUM = ifnull(OUT_SELF_MEMBER_NUM,0)+"+param.getOutSelfMemberNum() ) ); } } @@ -184,36 +192,41 @@ if(StringUtils.isNotBlank(userNo)){ Member member = memberMapper.selectJoinOne(Member.class,new MPJLambdaWrapper<Member>() .selectAll(Member.class) - .selectAs(Member::getCompanyType,Company::getType) + .selectAs(Company::getType,Member::getCompanyType) .leftJoin(Company.class,Company::getId,Member::getCompanyId) .eq(Member::getHkId,userNo) + .eq(Member::getIsdeleted,Constants.ZERO) .last("limit 1")); //濡傛灉浜哄憳淇℃伅瀛樺湪锛屽垯鍒犻櫎涔嬪墠鐨勬墍鏈夎繘鍦烘暟鎹紙鏃犺姝ゆ鎺ㄩ�佹槸杩涘巶杩樻槸鍑哄満鎺ㄩ�佷簨浠讹級 Device d = deviceMapper.selectOne(new QueryWrapper<Device>().lambda() .eq(Device::getDoorId,request.getSrcIndex()) .eq(Device::getIsdeleted,Constants.ZERO) .last("limit 1" )); - if(d!=null && !(Constants.equalsInteger(d.getIsEntrance(),Constants.ONE) && Constants.formatIntegerNum(request.getData().getExtEventInOut()) != Constants.ONE)){ - //濡傛灉鏄繘闂紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰� - inoutDayCount.setInMemberNum(Constants.formatIntegerNum(inoutDayCount.getInMemberNum())+1);//鍏ュ満浜烘 - }else{ - inoutDayCount.setOutMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutMemberNum())+1);//绂诲満浜烘 + if(d!=null && Constants.equalsInteger(d.getIsEntrance(),Constants.ONE)){ + if(Constants.formatIntegerNum(request.getData().getExtEventInOut()) != Constants.ONE){ + //濡傛灉鏄繘闂紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰� + inoutDayCount.setInMemberNum(Constants.formatIntegerNum(inoutDayCount.getInMemberNum())+1);//鍏ュ満浜烘 + }else{ + inoutDayCount.setOutMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutMemberNum())+1);//绂诲満浜烘 + } } if(member !=null){ - delRetentionLis.add(member.getId()); - if(d!=null && !(Constants.equalsInteger(d.getIsEntrance(),Constants.ONE) && Constants.formatIntegerNum(request.getData().getExtEventInOut()) != Constants.ONE)){ - //濡傛灉鏄繘闂紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰� - retentionList.add(getRetentionModelByRequest(member,request)); - if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ - inoutDayCount.setInSelfMemberNum(Constants.formatIntegerNum(inoutDayCount.getInSelfMemberNum())+1);//鍐呴儴浜哄憳鍏ュ満浜烘 + if(d!=null && Constants.equalsInteger(d.getIsEntrance(),Constants.ONE)){ + delRetentionLis.add(member.getId()); + if( Constants.formatIntegerNum(request.getData().getExtEventInOut()) == Constants.ONE){ + //濡傛灉鏄繘闂紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰� + retentionList.add(getRetentionModelByRequest(member,request)); + if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ + inoutDayCount.setInSelfMemberNum(Constants.formatIntegerNum(inoutDayCount.getInSelfMemberNum())+1);//鍐呴儴浜哄憳鍏ュ満浜烘 + }else{ + inoutDayCount.setInOtherMemberNum(Constants.formatIntegerNum(inoutDayCount.getInOtherMemberNum())+1);//鐩稿叧鏂瑰叆鍦轰汉娆� + } }else{ - inoutDayCount.setInOtherMemberNum(Constants.formatIntegerNum(inoutDayCount.getInOtherMemberNum())+1);//鐩稿叧鏂瑰叆鍦轰汉娆� - } - }else{ - if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ - inoutDayCount.setOutSelfMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutSelfMemberNum())+1);//鍐呴儴浜哄憳鍑哄満浜烘 - }else{ - inoutDayCount.setOutOtherMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutOtherMemberNum())+1);//鐩稿叧鏂瑰嚭鍦轰汉娆� + if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ + inoutDayCount.setOutSelfMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutSelfMemberNum())+1);//鍐呴儴浜哄憳鍑哄満浜烘 + }else{ + inoutDayCount.setOutOtherMemberNum(Constants.formatIntegerNum(inoutDayCount.getOutOtherMemberNum())+1);//鐩稿叧鏂瑰嚭鍦轰汉娆� + } } } } @@ -325,7 +338,6 @@ retention.setMemberId(member.getId()); retention.setDeviceName(request.getSrcName()); retention.setDeviceIndex(request.getSrcIndex()); - return retention; } @@ -436,7 +448,6 @@ } saveInterfaceLog(param,"/business/hksync/push/visitIccm",result,true); return null; - } /** @@ -486,7 +497,7 @@ delRetentionLis.add(visits.getMemberId()); //濡傛灉鏄瀹㈤�氳 if(request.getData()!=null&&request.getData().getParamValues()!=null && - StringUtils.equals(request.getData().getParamValues().getInOrOut(),"1")){ + StringUtils.equals(request.getData().getParamValues().getInOrOut(),"0")){ //濡傛灉鏄瀹㈢櫥璁帮紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰� Retention r = getRetentionModelByVisitRequest(visits, request.getHappenTime(),request.getSrcType()); r.setCarNo(request.getData().getParamValues().getPlateNos()); @@ -497,7 +508,7 @@ inoutDayCount.setInVisitorNum(Constants.formatIntegerNum(inoutDayCount.getInVisitorNum())+1); } if(request.getData()!=null&&request.getData().getParamValues()!=null && - StringUtils.equals(request.getData().getParamValues().getInOrOut(),"2")){ + !StringUtils.equals(request.getData().getParamValues().getInOrOut(),"0")){ inoutDayCount.setOutVisitorNum(Constants.formatIntegerNum(inoutDayCount.getOutVisitorNum())+1); } } @@ -563,6 +574,7 @@ event.setPhotoUrl(getHkImgUrl(detail.getFacePic())); event.setPersonName(detail.getVisitorName()); event.setCarNo(detail.getPlateNo()); + event.setRemark(JSONObject.toJSONString(request)); event.setInvoicesNo(request.getData().getVisitorInvoices().getInvoicesNo());//璁垮鍗曞彿 event.setIdType(detail.getCertType()); String idnum = detail.getCertNo(); @@ -742,7 +754,7 @@ dealInoutDayCountBiz(inoutDayCount); log.info("銆愭捣搴峰仠杞﹀満浜嬩欢鎺ㄩ�併��========鎴愬姛======="); }catch (Exception e){ - + e.printStackTrace(); log.error("銆愭捣搴峰仠杞﹀満浜嬩欢鎺ㄩ�併��========澶辫触=======锛歕n"+e.getMessage()); } saveInterfaceLog(param,"/business/hksync/push/parks",result,false); @@ -813,6 +825,75 @@ .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() + .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); + } + } + } }else{ Visits visits = visitsMapper.selectOne(new QueryWrapper<Visits>().lambda() .eq(Visits::getCarNos,event.getPlateNos()) -- Gitblit v1.9.3