Browse Source

修改短信发送逻辑 过期后才能发新的验证码

liangjianf 2 years ago
parent
commit
ded8d79b08

+ 6 - 1
beidou-framework/src/main/java/cn/com/taiji/beidou/framework/web/service/SysLoginService.java

@@ -184,12 +184,17 @@ public class SysLoginService
             if(sysUser==null){
                 return R.fail("手机号码不存在!请联系管理员");
             }
+            String code = redisCache.getCacheObject(telephone);
+            if (!StringUtils.isEmpty(code)){
+                return R.ok();
+//                return R.fail("验证码仍在有效期,请等待.");
+            }
             String randomCode = SmsUtil.getRandomCode(6);
 
             String result = SmsUtil.sendSms(telephone, randomCode);
             if(result.contains("success")){
                 //todo 此处将验证码存储到数据库
-                redisCache.setCacheObject(telephone,randomCode,10, TimeUnit.MINUTES);
+                redisCache.setCacheObject(telephone,randomCode,5, TimeUnit.MINUTES);
             }
             return R.ok(result);
         } catch (Exception e) {

+ 1 - 1
beidou-framework/src/main/java/cn/com/taiji/beidou/framework/web/util/SmsUtil.java

@@ -95,7 +95,7 @@ public class SmsUtil{
         System.out.println("mobiles:"+ submit.get("mobiles"));
 
         // 短信内容
-        submit.put("content","【海南社会管理信息化平台】 您的登录验证码为:" + validCode + "。有效时长为10分钟,请勿将验证码告知他人。");
+        submit.put("content","【海南社会管理信息化平台】 您的登录验证码为:" + validCode + "。有效时长为5分钟,请勿将验证码告知他人。");
         System.out.println("content:"+ submit.get("content"));
 
         // 签名

+ 2 - 2
beidou-track-geomesa/src/main/java/cn/com/taiji/track/dto/BeidouShipLocationDTO.java

@@ -50,8 +50,8 @@ public class BeidouShipLocationDTO extends IGeomesaTrackDTO implements Serializa
     @Override
     public boolean checkPoint() {
         if (location != null) {
-            longitude = location.substring(location.indexOf("(")+1,location.indexOf(" ",location.indexOf("(")));
-            latitude = location.substring(location.indexOf(" ",location.indexOf("("))+1,location.indexOf(")"));
+//            longitude = location.substring(location.indexOf("(")+1,location.indexOf(" ",location.indexOf("(")));
+//            latitude = location.substring(location.indexOf(" ",location.indexOf("("))+1,location.indexOf(")"));
             return true;
         }
         return false;

+ 7 - 7
beidou-track-geomesa/src/main/java/cn/com/taiji/track/service/impl/BeidouLocationServiceImpl.java

@@ -75,10 +75,10 @@ public class BeidouLocationServiceImpl extends ServiceImpl<BeidouLocationMapper,
                     BeidouLocationEntity locationEntity = JSONObject.parseObject(msg.toString(), BeidouLocationEntity.class);
                     String location = StrUtil.format("POINT ({} {})", locationEntity.getLongitude(),locationEntity.getLatitude());
                     locationEntity.setLocation(location);
-                    BigDecimal longitudeDecimal = new BigDecimal(locationEntity.getLongitude());
-                    locationEntity.setLongitude(LatLngUtil.latLng2Dfm(longitudeDecimal.doubleValue()));
-                    BigDecimal latitudeDecimal = new BigDecimal(locationEntity.getLatitude());
-                    locationEntity.setLatitude(LatLngUtil.latLng2Dfm(latitudeDecimal.doubleValue()));
+//                    BigDecimal longitudeDecimal = new BigDecimal(locationEntity.getLongitude());
+//                    locationEntity.setLongitude(LatLngUtil.latLng2Dfm(longitudeDecimal.doubleValue()));
+//                    BigDecimal latitudeDecimal = new BigDecimal(locationEntity.getLatitude());
+//                    locationEntity.setLatitude(LatLngUtil.latLng2Dfm(latitudeDecimal.doubleValue()));
                     locationEntities.add(locationEntity);
                     shipStatusService.pushOnLineDeviceId(locationEntity.getDeviceId(),"true");
                 }
@@ -106,9 +106,9 @@ public class BeidouLocationServiceImpl extends ServiceImpl<BeidouLocationMapper,
                 String location = e.getLocation();
                 if (StringUtils.hasText(location) && !location.equals(locationMaps.get(e.getDeviceId()))) {
 //                if (StringUtils.hasText(location)) {
-                    String longitude = location.substring(location.indexOf("(")+1,location.indexOf(" ",location.indexOf("(")));
-                    String latitude = location.substring(location.indexOf(" ",location.indexOf("("))+1,location.indexOf(")"));
-                    List<ContainsDTO> result = warningAreaMapper.containsPoint(longitude,latitude);
+//                    String longitude = location.substring(location.indexOf("(")+1,location.indexOf(" ",location.indexOf("(")));
+//                    String latitude = location.substring(location.indexOf(" ",location.indexOf("("))+1,location.indexOf(")"));
+                    List<ContainsDTO> result = warningAreaMapper.containsPoint(e.getLongitude(),e.getLatitude());
                     if(result.size()>0){
                         shipStatusService.pushinportDeviceId(e.getDeviceId(), WarningCodeConstants.INPORT_WARNING);
                     }else{