Преглед изворни кода

新增小程序配置 修复

xgb пре 1 недеља
родитељ
комит
b335ac3d63

+ 17 - 18
fs-admin-saas/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java

@@ -98,24 +98,23 @@ public class FsCoursePlaySourceConfigController extends BaseController {
     @Log(title = "点播播放源配置", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Valid @RequestBody FsCoursePlaySourceConfigCreateParam param) {
-//        Wrapper<FsCoursePlaySourceConfig> queryWrapper = Wrappers.<FsCoursePlaySourceConfig>lambdaQuery()
-//                .eq(FsCoursePlaySourceConfig::getAppid, param.getAppid())
-//                .eq(FsCoursePlaySourceConfig::getIsDel, 0);
-//        if (fsCoursePlaySourceConfigService.count(queryWrapper) > 0) {
-//            return AjaxResult.error("appid已存在");
-//        }
-//        com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//        FsCoursePlaySourceConfig config = new FsCoursePlaySourceConfig();
-//        config.setCreateUserId(loginUser.getUserId());
-//        config.setCreateDeptId(loginUser.getDeptId());
-//        BeanUtils.copyProperties(param, config);
-//
-//        config.setIsDel(0);
-//        config.setCreateTime(LocalDateTime.now());
-//        config.setUpdateTime(LocalDateTime.now());
-//        fsCoursePlaySourceConfigService.save(config);
-//        return AjaxResult.success();
-        throw new RuntimeException("未实现");
+        Wrapper<FsCoursePlaySourceConfig> queryWrapper = Wrappers.<FsCoursePlaySourceConfig>lambdaQuery()
+                .eq(FsCoursePlaySourceConfig::getAppid, param.getAppid())
+                .eq(FsCoursePlaySourceConfig::getIsDel, 0);
+        if (fsCoursePlaySourceConfigService.count(queryWrapper) > 0) {
+            return AjaxResult.error("appid已存在");
+        }
+        LoginUser loginUser =  tokenService.getLoginUser(ServletUtils.getRequest());
+        FsCoursePlaySourceConfig config = new FsCoursePlaySourceConfig();
+        config.setCreateUserId(loginUser.getUserId());
+        config.setCreateDeptId(loginUser.getDeptId());
+        BeanUtils.copyProperties(param, config);
+
+        config.setIsDel(0);
+        config.setCreateTime(LocalDateTime.now());
+        config.setUpdateTime(LocalDateTime.now());
+        fsCoursePlaySourceConfigService.save(config);
+        return AjaxResult.success();
     }
 
     @PreAuthorize("@ss.hasPermi('course:playSourceConfig:edit')")

+ 87 - 87
fs-service/src/main/java/com/fs/company/utils/JwtUtils.java

@@ -1,87 +1,87 @@
-package com.fs.company.utils;
-
-import io.jsonwebtoken.Claims;
-import io.jsonwebtoken.Jwts;
-import io.jsonwebtoken.SignatureAlgorithm;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-import java.util.Date;
-
-/**
- * jwt工具类
-
- */
-@ConfigurationProperties(prefix = "fs.jwt")
-@Component
-public class JwtUtils {
-    private Logger logger = LoggerFactory.getLogger(getClass());
-
-
-    private String secret;
-    private long expire;
-    private String header;
-
-    /**
-     * 生成jwt token
-     */
-    public String generateToken(long userId) {
-        Date nowDate = new Date();
-        //过期时间
-        Date expireDate = new Date(nowDate.getTime() + expire * 1000);
-
-        return Jwts.builder()
-                .setHeaderParam("typ", "JWT")
-                .setSubject(userId+"")
-                .setIssuedAt(nowDate)
-                .setExpiration(expireDate)
-                .signWith(SignatureAlgorithm.HS512, secret)
-                .compact();
-    }
-
-    public Claims getClaimByToken(String token) {
-        try {
-            return Jwts.parser()
-                    .setSigningKey(secret)
-                    .parseClaimsJws(token)
-                    .getBody();
-        }catch (Exception e){
-            logger.debug("validate is token error ", e);
-            return null;
-        }
-    }
-
-    /**
-     * token是否过期
-     * @return  true:过期
-     */
-    public boolean isTokenExpired(Date expiration) {
-        return expiration.before(new Date());
-    }
-
-    public String getSecret() {
-        return secret;
-    }
-
-    public void setSecret(String secret) {
-        this.secret = secret;
-    }
-
-    public long getExpire() {
-        return expire;
-    }
-
-    public void setExpire(long expire) {
-        this.expire = expire;
-    }
-
-    public String getHeader() {
-        return header;
-    }
-
-    public void setHeader(String header) {
-        this.header = header;
-    }
-}
+//package com.fs.company.utils;
+//
+//import io.jsonwebtoken.Claims;
+//import io.jsonwebtoken.Jwts;
+//import io.jsonwebtoken.SignatureAlgorithm;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.boot.context.properties.ConfigurationProperties;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.Date;
+//
+///**
+// * jwt工具类
+//
+// */
+//@ConfigurationProperties(prefix = "fs.jwt")
+//@Component
+//public class JwtUtils {
+//    private Logger logger = LoggerFactory.getLogger(getClass());
+//
+//
+//    private String secret;
+//    private long expire;
+//    private String header;
+//
+//    /**
+//     * 生成jwt token
+//     */
+//    public String generateToken(long userId) {
+//        Date nowDate = new Date();
+//        //过期时间
+//        Date expireDate = new Date(nowDate.getTime() + expire * 1000);
+//
+//        return Jwts.builder()
+//                .setHeaderParam("typ", "JWT")
+//                .setSubject(userId+"")
+//                .setIssuedAt(nowDate)
+//                .setExpiration(expireDate)
+//                .signWith(SignatureAlgorithm.HS512, secret)
+//                .compact();
+//    }
+//
+//    public Claims getClaimByToken(String token) {
+//        try {
+//            return Jwts.parser()
+//                    .setSigningKey(secret)
+//                    .parseClaimsJws(token)
+//                    .getBody();
+//        }catch (Exception e){
+//            logger.debug("validate is token error ", e);
+//            return null;
+//        }
+//    }
+//
+//    /**
+//     * token是否过期
+//     * @return  true:过期
+//     */
+//    public boolean isTokenExpired(Date expiration) {
+//        return expiration.before(new Date());
+//    }
+//
+//    public String getSecret() {
+//        return secret;
+//    }
+//
+//    public void setSecret(String secret) {
+//        this.secret = secret;
+//    }
+//
+//    public long getExpire() {
+//        return expire;
+//    }
+//
+//    public void setExpire(long expire) {
+//        this.expire = expire;
+//    }
+//
+//    public String getHeader() {
+//        return header;
+//    }
+//
+//    public void setHeader(String header) {
+//        this.header = header;
+//    }
+//}