接受畅捷通的密钥
continuous-integration/drone Build is passing Details

沃森川job同步飞书
YXY 1 year ago
parent 5590c713ff
commit b4300cc19f

@ -1,24 +1,24 @@
package com.ruoyi.flyingbook.controller; package com.ruoyi.flyingbook.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.PdfUtils; import com.ruoyi.common.utils.PdfUtils;
import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper; import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.EventLog; import com.ruoyi.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.domain.edi.EdiResponseVo; import com.ruoyi.flyingbook.domain.edi.EdiResponseVo;
import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest; import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest;
import com.ruoyi.flyingbook.domain.edi.CJTEdiRequestVo;
import com.ruoyi.flyingbook.edi.EdiOperateService; import com.ruoyi.flyingbook.edi.EdiOperateService;
import com.ruoyi.flyingbook.service.IEventLogService; import com.ruoyi.flyingbook.service.IEventLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.File; import javax.crypto.Cipher;
import java.io.InputStream; import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
@Slf4j @Slf4j
@ -51,59 +51,27 @@ public class EdiController extends BaseController {
iEventLogService.insertEventLog(log1); iEventLogService.insertEventLog(log1);
EventLog log2 = new EventLog(); EventLog log2 = new EventLog();
iEventLogService.insertBatchEventLog(Arrays.asList(log1,log2)); iEventLogService.insertBatchEventLog(Arrays.asList(log1,log2));
}
// System.out.println(System.getProperty("user.dir")); /**
// ClassPathResource classPathResource = new ClassPathResource("photo/title.png"); *
// InputStream inputStream = null; */
// try { @PostMapping("/cjtTicket")
// inputStream = classPathResource.getInputStream(); public JSONObject receiveCjtTicket(@RequestBody CJTEdiRequestVo request) {
// File inuModel = new File("/"); try {
// FileUtils.copyToFile(inputStream, inuModel); log.error("receiveWscTicket request:{}",JSONObject.toJSONString(request));
// System.out.println(inuModel.getName()); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// } catch (Exception e) { cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec("ND2ANZB8F7NplUqc".getBytes(StandardCharsets.UTF_8), "AES"));
// log.error("", e); byte[] bytes = Base64.decodeBase64(request.getEncryptMsg());
// }finally { bytes = cipher.doFinal(bytes);
// if (inputStream != null){ String encryptMsg = new String(bytes, StandardCharsets.UTF_8);
// inputStream.close(); log.error("receiveWscTicket encryptMsg:{}",encryptMsg);
// } }catch (Exception e){
// } log.error("receiveWscTicket error request:{}",JSONObject.toJSONString(request),e);
// Resource resource = resourceLoader.getResource("classpath:photo/title.png"); }
// InputStream inputStream2 = null; JSONObject result = new JSONObject();
// try { result.put("result","success");
// inputStream2 = resource.getInputStream(); return result;
// File inuModel = new File("/");
// FileUtils.copyToFile(inputStream, inuModel);
// System.out.println(inuModel.getName());
// } catch (Exception e) {
// log.error("", e);
// }finally {
// if (inputStream2 != null){
// inputStream2.close();
// }
// }
// CourseFeedbackTemplateDto resultDTO = new CourseFeedbackTemplateDto();
// resultDTO.setProgram("program");
// resultDTO.setStudentName("student");
// resultDTO.setTutor("tutor");
// resultDTO.setStartClassTime("2023-05-21 15:51:45");
// resultDTO.setEndClassTime("2023-05-22 15:51:45");
// resultDTO.setFeedback("作业完成情况");
// resultDTO.setFeedbackScore("7 /10");
// resultDTO.setPerformance("课堂表现");
// resultDTO.setPerformanceScore("9/10");
// resultDTO.setContent("<p>1、课堂内容1</p><p>1、课堂内容2</p>");
// resultDTO.setWork("<p>1、课后作业1</p><p>1、课后作业2</p><p>1、课后作业3</p>");
// pdfUtils.createFile("COURSE_FEEDBACK.ftl",resultDTO);
// String path1 = System.getProperty("user.dir") + "/" + "test.pdf";
// File file1 = new File(path1);
// file1.delete();
// String path2 = System.getProperty("user.dir") + "/" + "test1.pdf";
// File file2 = new File(path2);
// Long length = file2.length();
// LarkFileRequest fileRequest = new LarkFileRequest("cli_a482a8572cbc9013","lZNXbCLlOslWbwBIVc4qvgxOdnfA8Mos",
// file2,file2.getName(),length.intValue(),"fldcnLt2RyUgDDD6rgC6K9gIWlM");
// larkFileHelper.uploadFile(fileRequest);
// file2.delete();
} }
} }

@ -0,0 +1,13 @@
package com.ruoyi.flyingbook.domain.edi;
import lombok.Data;
/**
* @author yuxiangyong
* @create 2023-03-12 16:00
*/
@Data
public class CJTEdiRequestVo {
private String encryptMsg;
}

@ -98,7 +98,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.authorizeRequests() .authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问 // 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage", "/approval","/syncEmail","/scheduledReminders", .antMatchers("/login", "/captchaImage", "/approval","/syncEmail","/scheduledReminders",
"/robot/callback", "/sync2Table", "/createPdf").anonymous() "/robot/callback", "/sync2Table", "/createPdf", "/cjtTicket").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/*.html", "/*.html",

Loading…
Cancel
Save