VerificationCodeIdentification.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.ydtech.modules.order.components;
  2. import com.ydtech.modules.order.entity.crawler.request.RecognitionRequest;
  3. import com.ydtech.modules.order.entity.crawler.response.RecognitionResponse;
  4. import org.springframework.beans.factory.annotation.Value;
  5. import org.springframework.http.HttpHeaders;
  6. import org.springframework.stereotype.Component;
  7. /**
  8. * @description: 验证码识别
  9. * @author: wenks
  10. * @date: 2023/9/19 18:17
  11. **/
  12. @Component
  13. public class VerificationCodeIdentification {
  14. @Value("${image.identificationUrl}")
  15. private String identificationUrl;
  16. private final InsCrawlerOrderComponents insCrawlerOrderComponents;
  17. public VerificationCodeIdentification(InsCrawlerOrderComponents insCrawlerOrderComponents) {
  18. this.insCrawlerOrderComponents = insCrawlerOrderComponents;
  19. }
  20. public RecognitionResponse recognition(RecognitionRequest request) {
  21. final String identificationLogId = "verification-code";
  22. return insCrawlerOrderComponents.post(identificationUrl, identificationLogId, "验证码识别", request, RecognitionResponse.class, new HttpHeaders());
  23. }
  24. }