From 362ec4c6c00747fb869b97ad3f0f3ce12b3e47aa Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期四, 10 十月 2024 15:15:46 +0800 Subject: [PATCH] 代码初始化 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 162 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 147 insertions(+), 15 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 ca890bf..5957712 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 @@ -13,10 +13,7 @@ import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; -import com.doumee.core.utils.Constants; -import com.doumee.core.utils.DateUtil; -import com.doumee.core.utils.PositionUtil; -import com.doumee.core.utils.Utils; +import com.doumee.core.utils.*; import com.doumee.dao.business.*; import com.doumee.dao.business.join.PlatformJobJoinMapper; import com.doumee.dao.business.join.PlatformJoinMapper; @@ -34,6 +31,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl; +import com.doumee.service.business.third.EmayService; import com.github.yulichang.wrapper.MPJLambdaWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -48,6 +47,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; +import java.util.Date; import java.util.stream.Collectors; /** @@ -96,6 +96,17 @@ @Autowired private VisitParkMapper visitParkMapper; + @Autowired + private SmsConfigMapper smsConfigMapper; + + @Autowired + private SmsEmailMapper smsEmailMapper; + + @Autowired + private EmayService emayService; + + @Autowired + private PlatformBroadcastLogMapper platformBroadcastLogMapper; @Override public Integer create(PlatformJob platformJob) { @@ -361,12 +372,30 @@ List<PlatformWmsDetail> platformWmsDetailList = platformWmsDetailMapper.selectList(new QueryWrapper<PlatformWmsDetail>().lambda() .eq(PlatformWmsDetail::getIsdeleted,Constants.ZERO) .eq(PlatformWmsDetail::getJobId,platformJob.getId())); + if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){ platformJob.setTotalNum( platformWmsDetailList.stream().map(m->m.getIoQty()).reduce(BigDecimal.ZERO,BigDecimal::add) ); platformWmsJob.setPlatformWmsDetailList(platformWmsDetailList); platformJob.setPlatformWmsJob(platformWmsJob); + + if(Constants.equalsInteger(platformJob.getType(),Constants.platformJobType.zyczh) + || Constants.equalsInteger(platformJob.getType(),Constants.platformJobType.wxczh)){ + + Integer unLockCount = platformWmsDetailList.stream().filter(i->Constants.equalsInteger(i.getLockStatus(),Constants.ZERO)).collect(Collectors.toList()).size(); + if(Constants.equalsInteger(unLockCount,Constants.ZERO)){ + platformJob.setLockStatus(Constants.TWO); //鍏ㄩ儴涓婇攣 + }else if(Constants.equalsInteger(unLockCount,platformWmsDetailList.size())){ + platformJob.setLockStatus(Constants.ZERO); //鏈笂閿� + }else{ + platformJob.setLockStatus(Constants.ONE); //閮ㄥ垎涓婇攣 + } + + } + + + } } } @@ -408,7 +437,7 @@ platformJob.setWaitTime(waitTime); } }else{ - platformJob.setWaitTime("绛夊緟鍙彿"); + platformJob.setWaitTime("棰勮绛夊緟锛�-灏忔椂-鍒嗛挓"); } }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey()) || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){ @@ -430,7 +459,6 @@ .ne(PlatformLog::getParam3,Constants.ZERO+"") .orderByDesc(PlatformLog::getCreateDate)); platformJob.setWorkTime(platformLogList.stream().map(m->Long.valueOf(m.getParam3())).reduce(Long.valueOf(0),Long::sum)); - } } @@ -463,7 +491,6 @@ //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺 this.queryWaitNum(platformJob); } - driverHomeVO.setPlatformJobList(platformJobList); @@ -677,6 +704,7 @@ .in(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey(), Constants.PlatformJobStatus.IN_WAIT.getKey(), Constants.PlatformJobStatus.CALLED.getKey()) + .orderByDesc(PlatformJob::getStatus) .orderByAsc(PlatformJob::getSignDate) ); //鑾峰彇鎵�鏈夋湀鍙扮粍 @@ -704,6 +732,7 @@ .in(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey(), Constants.PlatformJobStatus.IN_WAIT.getKey(), Constants.PlatformJobStatus.CALLED.getKey()) + .orderByDesc(PlatformJob::getStatus) .orderByDesc(PlatformJob::getSignDate)); platformGroup.setSignJobList(platformJobSignInList); //鏌ヨ褰撳墠鏈堝彴缁勪笅 @@ -806,6 +835,12 @@ //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.IN_WAIT.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.IN_WAIT.getInfo()); + + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobCallIn,null,null + ); return platformJob; } @@ -992,7 +1027,61 @@ //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.CALLED.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.CALLED.getInfo().replace("{data}",platform.getName())); + + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobSingIn,platform.getName(),null + ); + + //骞挎挱 led閫氱煡 + this.broadcastAndLEed(platformJob,Constants.PlatformBroadcastContent.CALLING.getInfo().replace("{param2}",platform.getName())); return platformJob; + } + + + public void broadcastAndLEed(PlatformJob model,String content){ + int speed = 13; + try { + speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode()); + }catch (Exception e){ + + } + List<PlatformDevice> deviceList = platformDeviceMapper.selectList(new QueryWrapper<PlatformDevice>().lambda() + .eq(PlatformDevice::getPlatformId,model.getPlatformId()) + .eq(PlatformDevice::getIsdeleted,Constants.ZERO)); + if(deviceList ==null || deviceList.size() == 0){ + return; + } + content = content.replace("${param}",model.getPlatformName()); + content = content.replace("${param2}",model.getCarCodeFront()); + List<String> broadcastList = new ArrayList<>(); + List<String> ledList = new ArrayList<>(); + String bNames = ""; + List<PlatformBroadcastLog> logList = new ArrayList<>(); + for(PlatformDevice device : deviceList){ + if(StringUtils.isNotBlank(device.getHkId())){ + continue; + } + if(Constants.equalsInteger(device.getType(),Constants.ZERO)){ + //濡傛灉鏄疞ED + PlatformBroadcastLog log = HkSyncPushServiceImpl.dealLedContentBiz(device.getHkNo(),device.getName(),content,speed,1); + logList.add(log); + ledList.add(device.getHkId()); + }else if(Constants.equalsInteger(device.getType(),Constants.ZERO)){ + //濡傛灉鏄箍鎾偣 + bNames += device.getName()+";"; + broadcastList.add(device.getHkId()); + } + } + if(broadcastList.size()>0){ + PlatformBroadcastLog log = HkSyncPushServiceImpl.dealBroadcastBiz(model,broadcastList,bNames,Constants.PlatformBroadcastContent.WRONG_IN.getInfo()); + logList.add(log); + } + if(logList.size()>0){ + platformBroadcastLogMapper.insert(logList); + } + } @@ -1044,6 +1133,13 @@ //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.TRANSFERING.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.TRANSFERING.getInfo().replace("{data}",oldPlatform.getName())); + + + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobMove,oldPlatform.getName(),platform.getName() + ); } @@ -1073,6 +1169,13 @@ //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.OVER_NUMBER.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.OVER_NUMBER.getInfo()); + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobOverNum,null,null + ); + + return platformJob; } @@ -1095,6 +1198,8 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�"); } + Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId()); + PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); @@ -1106,6 +1211,12 @@ //瀛樺偍鎿嶄綔鏃ュ織 savePlatformLog(Constants.PlatformJobLogType.EXCEPTION.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.EXCEPTION.getInfo()); + + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobError,platform.getName(),null + ); } @@ -1131,8 +1242,7 @@ if(Objects.isNull(platform)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鏈堝彴淇℃伅"); } - - + PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); if(Objects.isNull(platformJob.getStartDate())){ @@ -1146,6 +1256,12 @@ savePlatformLog(Constants.PlatformJobLogType.WORKING.getKey(),oldPlatformJob,platformJob, Constants.PlatformJobLogType.WORKING.getInfo().replace("{data}",platform.getName())); + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobWorking,platform.getName(),null + ); + return platformJob; } @@ -1168,6 +1284,13 @@ ||Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.EXCEPTION.getKey()) )){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�"); } + + + Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId()); + if(Objects.isNull(platform)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鏈堝彴淇℃伅"); + } + PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); @@ -1186,6 +1309,15 @@ //TODO 澶栧崗杞﹀嵏璐� 鎴栬�� 甯傚叕鍙歌溅鍗歌揣 鍒欐牴鎹换鍔℃儏鍐� } + + //鍙戦�佺煭淇′俊鎭� + SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, + emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), + SmsConstants.platformJobContent.platformJobFinish,platform.getName(),null + ); + + //骞挎挱 led閫氱煡 + this.broadcastAndLEed(platformJob,Constants.PlatformBroadcastContent.DONE.getInfo()); return platformJob; } @@ -1219,10 +1351,6 @@ savePlatformLog(Constants.PlatformJobLogType.AUTHED_LEAVE.getKey(),oldPlatformJob,platformJob , Constants.PlatformJobLogType.AUTHED_LEAVE.getInfo()); return platformJob; - - - - } @@ -1360,7 +1488,8 @@ } }else if(Constants.equalsInteger(objType,Constants.PlatformJobLogType.WORKING.getKey())){ platformLog.setParam1(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); - platformLog.setParam3("0"); + platformLog.setParam3("0"); + platformLog.setRemark(platformJobBefor.getPlatformId().toString()); }else{ platformLog.setParam3("0"); } @@ -1551,9 +1680,12 @@ ); platformDataListResponse.setWorkStatus(Constants.ONE); //鏌ヨ浣滀笟鏃堕暱 +// Long workTime = this.getWorkTime(platformJob); + Long min = (System.currentTimeMillis() - platformJob.getNewStartDate().getTime())/1000/60; platformDataListResponse.setWorkTime( - this.getWorkTime(platformJob) + min ); + //璁$畻宸蹭綔涓氭椂闀� 鏍规嵁鏈堝彴宸ヤ綔鏁堢巼 璁$畻浠诲姟閲忛渶瑕佹椂闂� if (Objects.isNull(platformJob.getWorkNum()) || Objects.isNull(platformJob.getWorkRate())) { platformDataListResponse.setFinishTime(null); -- Gitblit v1.9.3