| | |
| | | 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; |
| | | import com.doumee.dao.web.response.LineUpVO; |
| | | import com.doumee.dao.web.response.PlatformWorkVO; |
| | | import com.doumee.dao.web.response.platformReport.WholeProvinceBoardVO; |
| | | import com.doumee.service.business.PlatformJobService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | private EmayService emayService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private PlatformBroadcastLogMapper platformBroadcastLogMapper; |
| | | @Autowired |
| | | private PlatformWarnEventServiceImpl platformWarnEventService; |
| | |
| | | private MemberMapper memberMapper; |
| | | @Autowired |
| | | private WxNoticeConfigMapper wxNoticeConfigMapper; |
| | | @Autowired |
| | | private SystemUserMapper systemUserMapper; |
| | | |
| | | @Override |
| | | public Integer create(PlatformJob platformJob) { |
| | |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) { |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper, platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobCallIn, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | 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); |
| | |
| | | ); |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())){ |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){ |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper,platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobSingIn, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | if(Objects.nonNull(platformJob.getDriverId())){ |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobSingIn,platformJob); |
| | | } |
| | | |
| | | |
| | |
| | | ); |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) { |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper, platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobMove, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobMove,platformJob); |
| | | } |
| | | |
| | | platformJob.setPlatformName(oldPlatform.getName()); |
| | |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())){ |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){ |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper,platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobOverNum, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobOverNum,platformJob); |
| | | } |
| | | |
| | | platformJob.setPlatformName(platform.getName()); |
| | |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) { |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper, platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobError, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobError,platformJob); |
| | | } |
| | | |
| | | platformJob.setPlatformName(platform.getName()); |
| | |
| | | ); |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) { |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper, platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobWorking, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobWorking,platformJob); |
| | | } |
| | | //广播 led通知 |
| | | platformJob.setPlatformName(platform.getName()); |
| | |
| | | |
| | | 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){ |
| | |
| | | |
| | | //公众号模板消息 |
| | | if(Objects.nonNull(platformJob.getDriverId())) { |
| | | Member member = memberMapper.selectById(platformJob.getDriverId()); |
| | | if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) { |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | wxPlatNotice.sendPlatformJobTemplateNotice( |
| | | wxNoticeConfigMapper, platformJob, |
| | | WxPlatConstants.platformJobContent.platformJobFinish, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(member.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | this.sendWxNotice(WxPlatConstants.platformJobContent.platformJobFinish,platformJob); |
| | | } |
| | | |
| | | //广播 led通知 |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |