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/PlatformJobServiceImpl.java | 126 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 113 insertions(+), 13 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 6c229ad..3549483 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 @@ -17,7 +17,10 @@ import com.doumee.core.tms.model.response.TmsBaseResponse; import com.doumee.core.tms.model.response.TmsLockStatusQueryResponse; import com.doumee.core.utils.*; +import com.doumee.core.wx.wxPlat.WxPlatConstants; +import com.doumee.core.wx.wxPlat.WxPlatNotice; import com.doumee.dao.business.*; +import com.doumee.dao.business.dao.MemberMapper; import com.doumee.dao.business.dao.SmsConfigMapper; import com.doumee.dao.business.dao.SmsEmailMapper; import com.doumee.dao.business.join.PlatformJobJoinMapper; @@ -27,6 +30,7 @@ import com.doumee.dao.openapi.request.*; import com.doumee.dao.openapi.response.*; +import com.doumee.dao.system.SystemUserMapper; import com.doumee.dao.system.model.SystemUser; import com.doumee.dao.web.reqeust.*; import com.doumee.dao.web.response.DriverHomeVO; @@ -47,6 +51,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -55,6 +60,7 @@ import java.math.RoundingMode; import java.util.*; import java.util.Date; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -115,9 +121,17 @@ private EmayService emayService; @Autowired + private RedisTemplate<String, Object> redisTemplate; + @Autowired private PlatformBroadcastLogMapper platformBroadcastLogMapper; @Autowired private PlatformWarnEventServiceImpl platformWarnEventService; + @Autowired + private MemberMapper memberMapper; + @Autowired + private WxNoticeConfigMapper wxNoticeConfigMapper; + @Autowired + private SystemUserMapper systemUserMapper; @Override public Integer create(PlatformJob platformJob) { @@ -502,6 +516,14 @@ .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .eq(PlatformJob::getIsdeleted,Constants.ZERO) .eq(PlatformJob::getDrivierPhone,loginUserInfo.getMobile()) + .and(i->i.like(PlatformJob::getDoneDate,DateUtil.getCurrDate()) + .or().in(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey() + ,Constants.PlatformJobStatus.WAIT_CONFIRM.getKey(), + Constants.PlatformJobStatus.WART_SIGN_IN.getKey(), + Constants.PlatformJobStatus.IN_WAIT.getKey(), + Constants.PlatformJobStatus.CALLED.getKey(), + Constants.PlatformJobStatus.WORKING.getKey()) + ) .orderByDesc(PlatformJob::getId) ); for (PlatformJob platformJob:platformJobList) { @@ -512,7 +534,6 @@ } driverHomeVO.setPlatformJobList(platformJobList); - // 鍥尯瀵艰鍥� 鍥剧墖 driverHomeVO.setReservationMap(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.PLATFORM_GUIDEMAP).getCode()); // 棰勭害鎸囧崡 鏂囨湰 @@ -645,11 +666,11 @@ } public void sceneSignIn(SignInDTO signInDTO){ - if( StringUtils.isNotBlank(signInDTO.getQrCodeKey())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } - if(!signInDTO.getQrCodeKey().equals(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode())){ + if(!signInDTO.getQrCodeKey().equals( + systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode() + systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode())){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"浜岀淮鐮佸凡杩囨湡,璇峰埛鏂伴噸璇�"); } } @@ -722,6 +743,7 @@ ,PlatformJob::getId,lineUpDetailDTO.getJobId()) .in(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey(), Constants.PlatformJobStatus.IN_WAIT.getKey(), + Constants.PlatformJobStatus.WORKING.getKey(), Constants.PlatformJobStatus.CALLED.getKey()) .orderByDesc(PlatformJob::getStatus) .orderByAsc(PlatformJob::getSignDate) @@ -860,9 +882,42 @@ emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), SmsConstants.platformJobContent.platformJobCallIn,null,null ); - + + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())) { + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobCallIn,platformJob); + } return platformJob; } + + 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) + .eq(SystemUser::getMobile,platformJob.getDrivierPhone()) + .last(" limit 1 ")); + if (Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())) { + PlatformJob p = platformJobJoinMapper.selectJoinOne(PlatformJob.class, + new MPJLambdaWrapper<PlatformJob>() + .selectAll(PlatformJob.class) + .selectAs(Platform::getName,PlatformJob::getPlatformName) + .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) + .eq(PlatformJob::getId,platformJob.getId()) + .last(" limit 1") + ); + + WxPlatNotice wxPlatNotice = new WxPlatNotice(); + wxPlatNotice.sendPlatformJobTemplateNotice(systemDictDataBiz, + wxNoticeConfigMapper, p, + objCode, + systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), + Arrays.asList(driver.getOpenid().split(",")) + ); + } + } + + + private Logger logger = LoggerFactory.getLogger(PlatformJobServiceImpl.class); @@ -1058,6 +1113,12 @@ SmsConstants.platformJobContent.platformJobSingIn,platform.getName(),null ); + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())){ + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobSingIn,platformJob); + } + + //骞挎挱 led閫氱煡 platformJob.setPlatformName(platform.getName()); this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.CALLING.getInfo(), @@ -1188,6 +1249,11 @@ SmsConstants.platformJobContent.platformJobMove,oldPlatform.getName(),platform.getName() ); + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())) { + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobMove,platformJob); + } + platformJob.setPlatformName(oldPlatform.getName()); platformJob.setPlatformId(oldPlatform.getId()); this.broadcastAndLEed(platformJob, StringUtils.isBlank(oldPlatform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():oldPlatform.getLedContent(), @@ -1216,7 +1282,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�"); } - Platform platform = platformJoinMapper.selectById(jobOperateDTO.getPlatformId()); + Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId()); if(Objects.isNull(platform)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鏈堝彴淇℃伅"); } @@ -1235,6 +1301,12 @@ emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), SmsConstants.platformJobContent.platformJobOverNum,null,null ); + + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())){ + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobOverNum,platformJob); + } + platformJob.setPlatformName(platform.getName()); this.broadcastAndLEed(platformJob, StringUtils.isBlank(platform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():platform.getLedContent(), null @@ -1281,6 +1353,11 @@ emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), SmsConstants.platformJobContent.platformJobError,platform.getName(),null ); + + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())) { + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobError,platformJob); + } platformJob.setPlatformName(platform.getName()); this.broadcastAndLEed(platformJob, StringUtils.isBlank(platform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():platform.getLedContent(), @@ -1331,7 +1408,10 @@ emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), SmsConstants.platformJobContent.platformJobWorking,platform.getName(),null ); - + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())) { + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobWorking,platformJob); + } //骞挎挱 led閫氱煡 platformJob.setPlatformName(platform.getName()); this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.WORKING.getInfo(), @@ -1340,11 +1420,22 @@ return platformJob; } - - - /** - * 瀹屾垚浣滀笟 - */ + + @Override + public PlatformJob getLastWaitJob(String uuid, LoginUserInfo loginUser){ + String u = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.BIGSCREEN_UUID); + if(!StringUtils.equals(u,uuid)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝浜岀淮鐮佸凡澶辨晥锛�"); + } + PlatformJob platformJob = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda() + .eq(PlatformJob::getDrivierPhone,loginUser.getMobile()) + .eq(PlatformJob::getIsdeleted,Constants.ZERO) + .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WART_SIGN_IN.getKey()) + .orderByDesc(PlatformJob::getCreateDate) + .last(" limit 1 ") ); + return platformJob; + } + @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public PlatformJob finishWork(JobOperateDTO jobOperateDTO){ @@ -1416,6 +1507,12 @@ emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(), SmsConstants.platformJobContent.platformJobFinish,platform.getName(),null ); + + //鍏紬鍙锋ā鏉挎秷鎭� + if(Objects.nonNull(platformJob.getDriverId())) { + this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobFinish,platformJob); + } + //骞挎挱 led閫氱煡 platformJob.setPlatformName(platform.getName()); this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.DONE.getInfo(), @@ -2003,7 +2100,11 @@ List<PlatformJob> calledList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList()); largeScreenDataVO.setWaitWorkList(calledList); } - largeScreenDataVO.setQrCode(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode()); + 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()); return largeScreenDataVO; } @@ -2110,7 +2211,6 @@ } } - -- Gitblit v1.9.3