523096025 hace 1 año
padre
commit
b253a98df0

+ 15 - 2
huimv-eartag2-eartag/src/test/java/com/huimv/eartag2/eartag/service/ServiceTest.java

@@ -3,7 +3,7 @@ package com.huimv.eartag2.eartag.service;
 import com.huimv.eartag2.common.service.IBaseConfigService;
 import com.huimv.eartag2.common.service.impl.BaseConfigServiceImpl;
 import com.huimv.eartag2.common.utils.BizConst;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -29,7 +29,20 @@ public class ServiceTest {
     @Autowired
     private IBaseConfigService iBaseConfigService;
     @Autowired
-    private RedisTemplate redisTemplate;
+    public RedisTemplate redisTemplate;
+
+
+    @Test
+    public  void test4 (){
+        String hashKey = "hash:tempAlarm:farmCode:110101002";
+//        redisTemplate.opsForHash().delete(hashKey);
+        redisTemplate.opsForHash().put(hashKey,"eartagMaxTem","30");
+        redisTemplate.opsForHash().put(hashKey,"eartagMinTem","20");
+
+        System.out.println(  redisTemplate.opsForHash().get(hashKey,"eartagMaxTem"));
+        System.out.println(  redisTemplate.opsForHash().get(hashKey,"eartagMinTem"));
+
+    }
 
     @Test
     public void test_1(){

+ 1 - 1
huimv-eartag2-manage2/src/main/java/com/huimv/eartag2/manage2/service/impl/SysBaseConfigServiceImpl.java

@@ -397,7 +397,7 @@ public class SysBaseConfigServiceImpl extends ServiceImpl<SysBaseConfigMapper, S
             newBaseConfig.setRowId(rowId);
             sysBaseConfigMapper.insert(newBaseConfig);
         }
-        redisTemplate.opsForHash().delete(hashKey);
+//        redisTemplate.delete(hashKey);
         redisTemplate.opsForHash().put(hashKey,"eartagMaxTem",eartagMaxTem);
         redisTemplate.opsForHash().put(hashKey,"eartagMinTem",eartagMinTem);
 

+ 2 - 0
huimv-eartag2-manage2/src/test/java/com/huimv/eartag2/manange2/service/IEartagServiceTest.java

@@ -1,5 +1,6 @@
 package com.huimv.eartag2.manange2.service;
 
+import com.huimv.eartag2.common.utils.BizConst;
 import com.huimv.eartag2.manage2.service.FarmerAssetService;
 import com.huimv.eartag2.manage2.service.IEartagService;
 import com.huimv.eartag2.common.utils.DateUtil;
@@ -7,6 +8,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.text.ParseException;