Переглянути джерело

2021/5/24 测试放开验证码

yinhao 4 роки тому
батько
коміт
84302128b8

+ 64 - 0
huimv-smart-apiservice/src/test/java/com/huimv/apiservice/HuimvSmartApiserviceApplicationTests.java

@@ -1,13 +1,77 @@
 package com.huimv.apiservice;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.huimv.apiservice.dao.IndoorEnvironmentDao;
+import com.huimv.apiservice.entity.IndoorEnvironmentEntity;
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
 @SpringBootTest
 class HuimvSmartApiserviceApplicationTests {
 
+    @Autowired
+    private IndoorEnvironmentDao indoorEnvironmentDao;
+
     @Test
     void contextLoads() {
+
+    }
+
+
+    @Test
+    void createIndoorEnv() {
+
+        DateTime today = DateUtil.beginOfDay(new Date());
+        System.out.println(today);
+//        BigDecimal bigDecimal = new BigDecimal(Math.random() * 8 + 25).setScale(1, BigDecimal.ROUND_HALF_UP);
+//        double temperature = bigDecimal.doubleValue();
+
+//        BigDecimal bigDecimal2 = new BigDecimal(Math.random() * 0.3 + 0.3).setScale(2, BigDecimal.ROUND_HALF_UP);
+//        double humidity = bigDecimal2.doubleValue();
+
+//        System.out.println(temperature + " " + humidity);
+        Date collectTime = today;
+
+        List<String> gas = new ArrayList<>();
+        gas.add("优");
+        gas.add("良");
+        gas.add("轻度");
+        gas.add("中度");
+        gas.add("重度");
+        gas.add("严重");
+
+        Random random = new Random();
+        List<IndoorEnvironmentEntity> list = new ArrayList<>();
+        for (int i = 0; i < 288; i++) {
+            IndoorEnvironmentEntity entity = new IndoorEnvironmentEntity();
+            entity.setDate(today);
+            entity.setPigstyId(1);
+            BigDecimal bigDecimal = new BigDecimal(Math.random() * 8 + 25).setScale(1, BigDecimal.ROUND_HALF_UP);
+            double temperature = bigDecimal.doubleValue();
+            entity.setTemperature(temperature);
+            BigDecimal bigDecimal2 = new BigDecimal(Math.random() * 0.3 + 0.3).setScale(2, BigDecimal.ROUND_HALF_UP);
+            double humidity = bigDecimal2.doubleValue();
+            entity.setHumidity(humidity);
+            entity.setGas(gas.get(random.nextInt(5)));
+            entity.setCollectTime(collectTime);
+            collectTime = DateUtil.offsetMinute(collectTime,5);
+            System.out.println(entity);
+            list.add(entity);
+        }
+
+//        indoorEnvironmentDao.batchInsertData(list)
+
+
+
+
+
+
     }
 
 }

+ 1 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/impl/PastureServiceImpl.java

@@ -44,6 +44,7 @@ public class PastureServiceImpl extends ServiceImpl<PastureDao, PastureEntity> i
         if (StringUtils.isNotEmpty(keywords)) {
             lambdaQuery.apply("CONCAT(name,front_location ,manager,build_time) like CONCAT('%',{0},'%')",keywords);
         }
+        lambdaQuery.orderByDesc(PastureEntity::getBuildTime);
 
         IPage<PastureEntity> page = page(this.page(
                 new Query<PastureEntity>().getPage(params)

+ 1 - 1
huimv-smart-management/src/main/resources/logback-spring.xml

@@ -9,7 +9,7 @@
         <logger name="org.springframework.web" level="INFO"/>
         <logger name="org.springboot.sample" level="INFO" />
         <logger name="com.huimv" level="DEBUG" />
-        <logger name="c.a.druid.pool" level="ERROR" />
+        <logger name="com.alibaba.druid.pool" level="ERROR"/>
     </springProfile>
 
     <!-- 生产环境 -->

+ 4 - 4
renren-fast/src/main/java/io/renren/modules/sys/controller/SysLoginController.java

@@ -64,10 +64,10 @@ public class SysLoginController extends AbstractController {
 	 */
 	@PostMapping("/sys/login")
 	public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
-		boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
-		if(!captcha){
-			return R.error("验证码不正确");
-		}
+//		boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
+//		if(!captcha){
+//			return R.error("验证码不正确");
+//		}
 
 		//用户信息
 		SysUserEntity user = sysUserService.queryByUserName(form.getUsername());

+ 1 - 1
renren-fast/src/main/java/io/renren/modules/sys/service/impl/SysCaptchaServiceImpl.java

@@ -44,7 +44,7 @@ public class SysCaptchaServiceImpl extends ServiceImpl<SysCaptchaDao, SysCaptcha
 
         SysCaptchaEntity captchaEntity = new SysCaptchaEntity();
         captchaEntity.setUuid(uuid);
-        captchaEntity.setCode(code);
+        captchaEntity.setCode("1234");
         //5分钟后过期
         captchaEntity.setExpireTime(DateUtils.addDateMinutes(new Date(), 5));
         this.save(captchaEntity);