From bd6c1c1c6642d57c85816a62d77c25c4e1a66a76 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期二, 02 一月 2024 09:38:46 +0800 Subject: [PATCH] zjh 2024/01/02--1 --- ltkj-admin/src/test/java/zjhTest.java | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 47 insertions(+), 7 deletions(-) diff --git a/ltkj-admin/src/test/java/zjhTest.java b/ltkj-admin/src/test/java/zjhTest.java index dd3150e..d4ed7e5 100644 --- a/ltkj-admin/src/test/java/zjhTest.java +++ b/ltkj-admin/src/test/java/zjhTest.java @@ -1,9 +1,12 @@ +import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.LtkjApplication; import com.ltkj.common.core.redis.RedisCache; import com.ltkj.common.utils.SecurityUtils; import com.ltkj.hosp.domain.DictHosp; +import com.ltkj.hosp.domain.TjProject; import com.ltkj.hosp.service.*; import lombok.extern.slf4j.Slf4j; import org.junit.Test; @@ -13,11 +16,15 @@ 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 org.springframework.web.bind.annotation.PostMapping; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -34,8 +41,8 @@ // // @Autowired // private ITjGroupingProService groupingProService; -// @Autowired -// private ITjProjectService projectService; + @Autowired + private ITjProjectService projectService; // // @Resource // private ITjOrderService tjOrderService; @@ -44,11 +51,11 @@ // @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 @@ -59,11 +66,44 @@ 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); +// // 澶勭悊鍖归厤鐨刱ey +// List<Object> multiCacheMapValue = redisCache.getMultiCacheMapValue(key, null); +// list.add(multiCacheMapValue); +// } // } +// System.out.println(list); +// System.out.println(redisCache.getMultiCacheMapValue("check",null)); +// } + +/* LambdaQueryWrapper<TjProject> wq=new LambdaQueryWrapper<>(); + wq.eq(TjProject::getProParentId,0); + List<TjProject> projectList = projectService.list(wq); + for (TjProject project : projectList) { + LambdaQueryWrapper<TjProject> wqq=new LambdaQueryWrapper<>(); + wqq.eq(TjProject::getProParentId,project.getProId()); + List<TjProject> list = projectService.list(wqq); + for (TjProject tjProject : list) { + tjProject.setDeptId(project.getDeptId()); + projectService.updateById(tjProject); + } + }*/ } -- Gitblit v1.8.0