jiangping
2024-12-10 bdbc59fad455abbe7a13c8017e71c3db96420444
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
@@ -49,6 +49,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;
@@ -57,6 +58,7 @@
import java.math.RoundingMode;
import java.util.*;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -116,6 +118,8 @@
    @Autowired
    private EmayService emayService;
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    @Autowired
    private PlatformBroadcastLogMapper platformBroadcastLogMapper;
    @Autowired
@@ -1431,10 +1435,19 @@
        return platformJob;
    }
    /**
     * 完成作业
     */
    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){
@@ -2108,6 +2121,8 @@
            List<PlatformJob> calledList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList());
            largeScreenDataVO.setWaitWorkList(calledList);
        }
        String u =  UUID.randomUUID().toString();
        redisTemplate.opsForValue().set(Constants.RedisKeys.BIGSCREEN_UUID,u,3, TimeUnit.MINUTES);
        largeScreenDataVO.setQrCode(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode());
        return largeScreenDataVO;