Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
# Conflicts: # coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyPartnerInterviewPlanMapper.java # coolstore-partner-dao/src/main/resources/mapper/HyPartnerInterviewPlanMapper.xml
This commit is contained in:
@@ -10,6 +10,8 @@ public class CommonConstants {
|
||||
|
||||
public static final String REQUEST_ID = "requestId";
|
||||
|
||||
public static final String MESSAGE_ID = "messageId";
|
||||
|
||||
public static final String ACCESS_TOKEN_KEY = "access_token";
|
||||
|
||||
public static final String REFRESH_TOKEN_KEY = "refresh_token";
|
||||
|
||||
@@ -189,6 +189,11 @@ public class RedisConstant {
|
||||
|
||||
public static final String STOREWORK_NOTICE_KEY = "storeWorkNoticeCache:{0}:{1}:{2}:{3}";
|
||||
|
||||
/**
|
||||
* 冷静期内是否首次登录 冷静期首次登录 是-true 否-false
|
||||
*/
|
||||
public static final String COOLINGPERIOD_FIRSTLOGIN_KEY = "coolingPeriodFirstLoginCache:{0}";
|
||||
|
||||
/**
|
||||
* 七天
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,7 @@ public enum ErrorCodeEnum {
|
||||
IDENTITY_CARD_PARSE_FAIL(1021080, "身份证解析失败", null),
|
||||
PARAMS_REQUIRED(400002, "参数缺失!", null),
|
||||
DATA_CONVERT_ERROR(400002, "日期转换异常!", null),
|
||||
PARENT_NODE_NOT_EXIST(400002, "父节点不存在", null),
|
||||
|
||||
|
||||
LINE_ID_IS_NOT_EXIST(500001, "线索ID不存在!", null),
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: IDCardSideEnum
|
||||
* @Description: 身份证正反面类型
|
||||
* @date 2023-06-16 16:49
|
||||
*/
|
||||
public enum IDCardSideEnum {
|
||||
|
||||
FACE("face", "正面"),
|
||||
BACK("back", "反面")
|
||||
;
|
||||
|
||||
private String code;
|
||||
|
||||
private String message;
|
||||
|
||||
IDCardSideEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,16 @@ import com.lowagie.text.Font;
|
||||
import com.lowagie.text.Image;
|
||||
import com.lowagie.text.Paragraph;
|
||||
import com.lowagie.text.pdf.*;
|
||||
import org.icepdf.core.exceptions.PDFException;
|
||||
import org.icepdf.core.exceptions.PDFSecurityException;
|
||||
import org.icepdf.core.pobjects.Page;
|
||||
import org.icepdf.core.util.GraphicsRenderingHints;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* 使用 OpenPDF 封装的 pdf 工具类
|
||||
@@ -120,7 +126,46 @@ public class PDFUtils {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* PDF 转图片
|
||||
* @param inputStream pdf 输入流
|
||||
* @param scale 缩放比例
|
||||
*/
|
||||
public static ByteArrayOutputStream pdf2Img(InputStream inputStream, float scale) {
|
||||
org.icepdf.core.pobjects.Document document = new org.icepdf.core.pobjects.Document();
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
document.setInputStream(inputStream, "");
|
||||
|
||||
float rotation = 0f;// 旋转角度
|
||||
for (int i = 0; i < document.getNumberOfPages(); i++) {
|
||||
BufferedImage image = (BufferedImage) document.getPageImage(i,
|
||||
GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX,
|
||||
rotation, scale);
|
||||
RenderedImage rendImage = image;
|
||||
try {
|
||||
ImageIO.write(rendImage, "png", outputStream);
|
||||
//例子中是pdf转png格式的,也可以将上面两行改成jpg,转出jpg格式的,
|
||||
//但是从转换效果来看png的清晰度会相对较高。有个小技巧是第一行行改成jpg,
|
||||
//但第二行使用png,也就是转换成jpg格式但有png清晰度的图片。
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
image.flush();
|
||||
document.dispose();
|
||||
return outputStream;
|
||||
}
|
||||
} catch (PDFException | PDFSecurityException | IOException e1) {
|
||||
e1.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return outputStream;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Image;
|
||||
import com.lowagie.text.pdf.BaseFont;
|
||||
import com.lowagie.text.pdf.PdfReader;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
|
||||
@@ -41,15 +42,16 @@ public class PassLetterUtils {
|
||||
document.close();
|
||||
|
||||
//3. 填写通过函模板信息
|
||||
addContentToPdf(outputStream, partnerName + " 先生/女士", 122, 640);
|
||||
addContentToPdf(outputStream, passCode, 122, 558);
|
||||
addContentToPdf(outputStream, verifyCity, 155, 494);
|
||||
addContentToPdf(outputStream, "60天", 135, 450);
|
||||
addContentToPdf(outputStream, passTimeStr, 393, 152);
|
||||
addContentToPdf(outputStream, partnerName + " 先生/女士", 122, 638);
|
||||
addContentToPdf(outputStream, passCode, 122, 557);
|
||||
addContentToPdf(outputStream, verifyCity, 155, 492);
|
||||
addContentToPdf(outputStream, "60天", 135, 448);
|
||||
addContentToPdf(outputStream, passTimeStr, 385, 152);
|
||||
return outputStream;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
document.close();
|
||||
outputStream.close();
|
||||
@@ -73,8 +75,10 @@ public class PassLetterUtils {
|
||||
try {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
PdfReader pdfReader = new PdfReader(inputStream);
|
||||
PDFUtils.putParagraphAbsolutely(pdfReader, outputStream, x, y, content, 20, new Color(255, 82,25));
|
||||
} catch (IOException e) {
|
||||
String fontFamilyPath = PassLetterUtils.class.getResource("/static/Alibaba-PuHuiTi-Regular.ttf").getPath();
|
||||
BaseFont font = BaseFont.createFont(fontFamilyPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
PDFUtils.putParagraphAbsolutely(pdfReader, outputStream, x, y, content, font, 19, 1, new Color(255, 82,25));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user