TicketCodeCommonUtil.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.cyksj.common.util;
  2. import cn.hutool.core.util.StrUtil;
  3. /**
  4. * 项目名: yhlxj2
  5. * 文件名: TicketCodeCommonUtil
  6. * 创建者: JavaZou
  7. * 创建时间:2024/5/24 15:31
  8. */
  9. public class TicketCodeCommonUtil {
  10. /**
  11. * 车票邮箱验证码
  12. */
  13. public static String getTicketCodeStr(String body, Long goodsId) {
  14. if (StrUtil.isEmpty(body)) {
  15. return body;
  16. }
  17. String str = null;
  18. if (goodsId == 33l) {
  19. str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
  20. }
  21. if (goodsId == 3l) {
  22. str = "letter-spacing:4px; line-height:38px; mso-line-height-rule: exactly";
  23. }
  24. if (StrUtil.isEmpty(str)) {
  25. return str;
  26. }
  27. int index = body.indexOf(str);
  28. if (index == -1) {
  29. if (goodsId == 33l) {
  30. str = "X-Report-Abuse: abuse@adobe.com";
  31. }
  32. if (goodsId == 3l) {
  33. str = "Noto Sans Display', Helvetica, Arial, sans-serif; font-weight: 600;text-align: center;";
  34. }
  35. index = body.indexOf(str);
  36. }
  37. String code = StrUtil.subWithLength(body, index, 512);
  38. if (StrUtil.isNotBlank(code)) {
  39. code = code.replace(str, "");
  40. }
  41. return code;
  42. }
  43. }