| | |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ltkj.LtkjApplication; |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | |
| | | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.redis.core.Cursor; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ScanOptions; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | // @Resource |
| | | // private ITjOrderRemarkService remarkService; |
| | | // |
| | | // @Resource |
| | | // private RedisCache redisCache; |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | // |
| | | // @Autowired |
| | | // public RedisTemplate<String,String> redisTemplate; |
| | | @Autowired |
| | | public RedisTemplate<Object,Object> redisTemplate; |
| | | // @Resource |
| | | // private StringRedisTemplate stringRedisTemplate; |
| | | @Resource |
| | |
| | | public void test() { |
| | | // List<DictHosp> list = dictHospService.list(); |
| | | // for (DictHosp dictHosp : list) { |
| | | // String mallMerchantSecretKey = SecurityUtils.getMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getAreaid(), dictHosp.getExpirationTime()); |
| | | // DateTime dateTime1 = DateUtil.offsetMonth(new Date(),6); |
| | | // String mallMerchantSecretKey = SecurityUtils.getMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getHospAreaName(),dictHosp.getExpirationTime()); |
| | | // dictHosp.setSecretKey(mallMerchantSecretKey); |
| | | // dictHosp.setExpirationTime(DateUtil.offsetDay(new Date(),30)); |
| | | // dictHospService.updateById(dictHosp); |
| | | // System.out.println(dateTime1); |
| | | // System.out.println("================================================="); |
| | | // System.out.println(mallMerchantSecretKey); |
| | | |
| | | // List<Object> list=new ArrayList<>(); |
| | | // ScanOptions options = ScanOptions.scanOptions().match("cS*").build(); |
| | | // try (Cursor<byte[]> cursor = redisTemplate.executeWithStickyConnection(redisConnection -> { |
| | | // return redisConnection.scan(options); |
| | | // })) { |
| | | // while (cursor.hasNext()) { |
| | | // byte[] keyBytes = cursor.next(); |
| | | // String key = new String(keyBytes); |
| | | // // 处理匹配的key |
| | | // List<Object> multiCacheMapValue = redisCache.getMultiCacheMapValue(key, null); |
| | | // list.add(multiCacheMapValue); |
| | | // } |
| | | // } |
| | | // System.out.println(list); |
| | | // System.out.println(redisCache.getMultiCacheMapValue("check",null)); |
| | | // } |
| | | } |
| | | |