فهرست منبع

暂时允许重复激活

zhengqiang 4 سال پیش
والد
کامیت
cdb853604b
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

+ 6 - 4
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -62,13 +63,14 @@ public class DriverApiController {
             if (vehicleInfo == null){
                 throw new Exception("车牌号或激活码错误");
             }
-            if ("1".equals(vehicleInfo.getStatus())){
-                throw new Exception("此车辆已被激活");
-            }
+//            if ("1".equals(vehicleInfo.getStatus())){
+//                throw new Exception("此车辆已被激活");
+//            }
             vehicleInfo.setStatus("1");
+            vehicleInfo.setUpdateTime(new Date());
             vehicleInfoService.update(vehicleInfo);
 
-            String token = JwtUtil.createToken(jwtSecret, vehicleInfo.getId(), DateTime.now().plusHours(6).toDate());
+            String token = JwtUtil.createToken(jwtSecret, vehicleInfo.getId(), DateTime.now().plusYears(1).toDate());
 
             Map<String,Object> map = new HashMap<>();
             map.put("token",token);