夏文涛 9 місяців тому
батько
коміт
b4c90249a5

+ 14 - 12
src/main/java/com/template/common/utils/JWTUtil.java

@@ -24,14 +24,16 @@ public class JWTUtil {
     /**
      * token过期时间,7天
      */
-//    private static final long EXPIRED = 1000 * 60 * 60 * 24 * 7;
-    private static final long EXPIRED = 1000 * 60 * 60 * 24;
+    //要加l long类型才可以
+//    private static final long EXPIRED = 7 * 24l * 60 * 60 * 1000;
+    private static final long EXPIRED = 7 * 24l * 60 * 60 * 1000;
 
     /**
      * 生成token 有过期时间
+     *
      * @return 返回token
      */
-    public static TokenDateVo getToken(String studentCard,Integer userId,Long expired){
+    public static TokenDateVo getToken(String studentCard, Integer userId, Long expired) {
 
         TokenDateVo result = new TokenDateVo();
         // 签发时间
@@ -45,13 +47,13 @@ public class JWTUtil {
         Map<String, Object> map = new HashMap<>();
         map.put("alg", "HMAC256");
         map.put("typ", "JWT");
-        Date expireTime = new Date(CommonUtil.getCurrentTimestamp() +  (expired == null ? EXPIRED : expired));
+        Date expireTime = new Date(CommonUtil.getCurrentTimestamp() + (expired == null ? EXPIRED : expired));
         String token = JWT.create()
                 .withHeader(map) // header
 //                .withClaim("identityType", ms.getIdentityType()) // 认证类型
 //                .withClaim("identifier", ms.getIdentifier()) // 登录标识
-                .withClaim("userId",String.valueOf( userId))
-                .withClaim("studentCard",studentCard)
+                .withClaim("userId", String.valueOf(userId))
+                .withClaim("studentCard", studentCard)
                 .withExpiresAt(expireTime) // 设置过期时间。过期时间要大于签发时间
                 .withIssuedAt(iatDate) // 设置签发时间
                 .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
@@ -80,28 +82,28 @@ public class JWTUtil {
 
     /**
      * 验证token
+     *
      * @param token
      */
-    public static void verify(String token){
+    public static void verify(String token) {
         JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
     }
 
     /**
      * 获取token中payload
+     *
      * @param token
      * @return
      */
-    public static DecodedJWT getToken(String token){
+    public static DecodedJWT getToken(String token) {
         return JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
     }
 
 
-
     /*
      * 解密Token
      * */
-    public static Map<String, Claim> verifyToken(String token)  {
-
+    public static Map<String, Claim> verifyToken(String token) {
 
 
         JWTVerifier verifier = JWT.require(Algorithm.HMAC256(SIGNATURE)).build();
@@ -115,7 +117,7 @@ public class JWTUtil {
         } catch (Exception e) {
             //throw new RuntimeException("登录凭证已过期,请重新登录");
             Map<String, Claim> result = new HashMap<>();
-            result.put("登录失效",null);
+            result.put("登录失效", null);
             return result;
         }
 

+ 1 - 1
src/main/java/com/template/controller/WelcomeBedController.java

@@ -776,7 +776,7 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
     @Override
     public CommonResult submit(String studentCard, WelcomeBed welcomeBed) {
         welcomeBed.setStudentCard(studentCard);
-//        先判断是否已经提交
+        //先判断是否已经提交
         LambdaQueryWrapper<WelcomeBed> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(WelcomeBed::getStudentCard, studentCard);
         WelcomeBed one = welcomeBedService.getOne(wrapper);

+ 1 - 43
src/main/resources/mapper/template/WelcomeStudentMapper.xml

@@ -23,19 +23,9 @@
         select (select count(id) from welcome_accompany where student_card = ws.card_id and deleted = 0) as accompanyNum,
         ws.id,ws.admiss_num,ws.name,ws.card_id,ws.college,ws.major,ws.classstr,
         ws.traffic_method,ws.arrive,ws.amount_payable,ws.pay_amount,ws.fill_status,
-        CONCAT(wsd.build, '-', wsd.dormitory, '-', wsd.number) as dormitory,ws.sex,ws.is_registered as isRegistered,wv.car_number as carNumber,ws.phone,wf.`name` as familyName,
-        wf.phone as familyPhone
+        CONCAT(wsd.build, '-', wsd.dormitory, '-', wsd.number) as dormitory,ws.sex,ws.is_registered as isRegistered
         from welcome_student ws
         left join welcome_bed wsd on wsd.deleted =0 and wsd.student_card = ws.card_id
-        left join welcome_visitor wv on wv.deleted =0 and wv.student_card = ws.card_id
-        left join (SELECT
-        f.*
-        FROM
-        welcome_family f
-        WHERE f.deleted=0
-        GROUP BY
-        f.student_card ) wf ON wf.deleted = 0
-        AND wf.student_card = ws.card_id
         where ws.deleted = 0
         <if test="collegeIds != null and collegeIds.size() > 0">
             and ws.college_id in
@@ -69,35 +59,9 @@
         <if test="isPay != null">
             and ws.is_pay = #{isPay}
         </if>
-        <if test="isCheck != null">
-            <if test="isCheck == 1">
-                and wsd.is_check = #{isCheck}
-            </if>
-            <if test="isCheck == 0">
-                and wsd.is_check is null
-            </if>
-        </if>
-        <if test="school != null and school != ''">
-            and ws.school = #{school}
-        </if>
-        <if test="batchValue != null and batchValue != ''">
-            and ws.batch_value = #{batchValue}
-        </if>
-        <if test="carNumber != null">
-            <if test="carNumber == 1">
-                and wv.car_number is not null
-            </if>
-            <if test="carNumber == 0">
-                and wv.car_number is null
-            </if>
-        </if>
         and ws.iden_type != 2
         order by ws.update_time desc
     </select>
-
-
-
-
     <select id="studentRegister" resultType="com.template.model.vo.StudentRegisterVo">
         SELECT count(ws.id) AS count,
 	           wo.`name`
@@ -121,9 +85,6 @@
             ws.deleted = 0
           AND ws.iden_type=1
           AND ws.fill_status = '已填报'
-        <if test="collegeId != null">
-            and ws.college_id = #{collegeId}
-        </if>
         GROUP BY
             traffic_method
     </select>
@@ -210,9 +171,6 @@
             ws.deleted = 0
           AND ws.iden_type=1
           AND ws.is_registered = 1
-         <if test="collegeId != null">
-            and ws.college_id = #{collegeId}
-         </if>
         GROUP BY
             ws.batch_value
     </select>