| | |
| | | import com.ruoyi.other.mapper.TechnicianSubscribeMapper; |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import com.ruoyi.other.vo.TechnicianSubscribeVO; |
| | | import org.springframework.data.redis.connection.RedisZSetCommands; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Resource |
| | | private RemoteOrderGoodsClient orderGoodsClient; |
| | | @Resource |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void switchingTechnician(TechnicianSubscribe technicianSubscribe) { |
| | | List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, technicianSubscribe.getOrderId()) |
| | | .eq(TechnicianSubscribe::getDelFlag, 0).eq(TechnicianSubscribe::getStatus, 0)); |
| | | for (TechnicianSubscribe subscribe : list) { |
| | | if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){ |
| | | throw new RuntimeException("不能切换相同的技师"); |
| | | } |
| | | subscribe.setTechnicianId(technicianSubscribe.getTechnicianId()); |
| | | this.updateById(subscribe); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 定时修改到期状态 |
| | | */ |
| | | @Override |
| | | public void taskEditStstus() { |
| | | Set<String> technician_subscribe = redisTemplate.opsForZSet().range("technician_subscribe", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | long second = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC); |
| | | Set<String> technician_subscribe = redisTemplate.opsForZSet().rangeByScore("technician_subscribe", 0, second); |
| | | if(technician_subscribe.size() > 0){ |
| | | List<TechnicianSubscribe> list = this.listByIds(technician_subscribe); |
| | | list.forEach(s->s.setStatus(3)); |