Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
This commit is contained in:
@@ -52,6 +52,10 @@ public enum ErrorCodeEnum {
|
||||
|
||||
|
||||
LINE_ID_IS_NOT_EXIST(500001, "线索ID不存在!", null),
|
||||
WORK_FLOW_STAGE_PASS_ERROR(500002, "通过错误,非对应阶段!", null),
|
||||
PARTNER_USER_NOT_EXIST(500002, "加盟商用户信息不存在!", null),
|
||||
|
||||
INTERVIEW_ENTER_FAIL(1021101, "进入面试间失败", null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
* @Date: 2023-06-13 20:22
|
||||
* @Description: 面试状态枚举
|
||||
*/
|
||||
public enum InteviewStatusEnum {
|
||||
WAIT_APPOINTMENT(0, "待预约"),
|
||||
|
||||
WAIT_APPOINTMENT_TIME_CONFIRM(1, "面试时间待审核"),
|
||||
WAIT_INTERVIEW(2, "待面试"),
|
||||
INTERVIEWING(3, "已开始"),
|
||||
WAIT_AUDIT(4, "待审核"),
|
||||
AUDITING(5, "审批中"),
|
||||
AUDIT_PASS(6, "审批通过"),
|
||||
REFUSE(7, "拒绝");
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
InteviewStatusEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/6/9 16:17
|
||||
@@ -21,6 +23,18 @@ public enum WorkflowStageEnum {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每个大节点对应的子节点最后一个流程
|
||||
* @return
|
||||
*/
|
||||
public static final HashMap<String,String> getWorkflowStageMap(){
|
||||
HashMap<String, String> result = new HashMap<>();
|
||||
result.put(INTENT.getCode(),WorkflowStatusEnum.INTENT_3.getCode());
|
||||
result.put(RESERVATION.getCode(),WorkflowStatusEnum.RESERVATION_6.getCode());
|
||||
result.put(INTERVIEW.getCode(),WorkflowStatusEnum.INTERVIEW_6.getCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -32,4 +34,22 @@ public class CoolDateUtils {
|
||||
now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
|
||||
return now.getTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* n天后 的最大时间 20230613 2天后最大时间---->2023-06-15 23:59:59
|
||||
* @param day
|
||||
* @return
|
||||
*/
|
||||
public static Date getDateFormatDay(int day){
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate thirdDay = today.plusDays(day);
|
||||
LocalDateTime thirdDayMidnight = LocalDateTime.of(thirdDay, LocalTime.MIDNIGHT);
|
||||
LocalDateTime thirdDay235959 = thirdDayMidnight.with(LocalTime.MAX);
|
||||
ZonedDateTime zonedDateTime = ZonedDateTime.of(thirdDay235959, ZoneId.systemDefault());
|
||||
return Date.from(zonedDateTime.toInstant());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Font;
|
||||
import com.lowagie.text.Image;
|
||||
import com.lowagie.text.Paragraph;
|
||||
import com.lowagie.text.pdf.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 使用 OpenPDF 封装的 pdf 工具类
|
||||
*/
|
||||
public class PDFUtils {
|
||||
|
||||
private static final int[] A4Size = {595, 842};
|
||||
|
||||
/**
|
||||
* 设置 pdf 背景图片(A4)
|
||||
* 每页都需要单独设置
|
||||
*/
|
||||
public static void setBackgroundImgA4(Document document, Image image) {
|
||||
//图片顶格
|
||||
image.setAbsolutePosition(0, 0);
|
||||
//填满 A4 大小的页面
|
||||
image.scaleAbsolute(A4Size[0], A4Size[1]);
|
||||
document.add(image);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 pdf 背景图片
|
||||
* 每页都需要单独设置
|
||||
*/
|
||||
public static void setBackgroundImg(Document document, Image image, int width, int height) {
|
||||
//图片顶格
|
||||
image.setAbsolutePosition(0, 0);
|
||||
image.scaleAbsolute(width, height);
|
||||
document.add(image);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文本放在 pdf 的绝对位置上来抠模板(不指定字体,默认为 OpenPDF 自带的 STSong-Light Normal)
|
||||
* @param reader PdfReader 流
|
||||
* @param outputStream 输出流
|
||||
* @param x 左边距
|
||||
* @param y 下边距
|
||||
* @param content 要插入的文本
|
||||
* @param fontSize 字体大小
|
||||
* @param color 文本颜色
|
||||
*/
|
||||
public static void putParagraphAbsolutely(PdfReader reader, OutputStream outputStream, float x, float y, String content, float fontSize, Color color) {
|
||||
try {
|
||||
BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
||||
addContent(reader, outputStream, content, x, y, baseFont, fontSize, 0, color);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定字体的文本绝对位置插入方法
|
||||
* @param reader PdfReader 流
|
||||
* @param outputStream 输出流
|
||||
* @param x 左边距
|
||||
* @param y 下边距
|
||||
* @param content 要插入的文本
|
||||
* @param baseFont 字体设置(如果不使用 OpenPDF 自带的字体,就需要将字体文件放在项目路径下)
|
||||
* 自定义字体方式
|
||||
* ttf 字体
|
||||
* 1. BaseFont baseFont = BaseFont.createFont("arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
* ttc 字体(包含了两种字体,所以需要选择 0 或 1)
|
||||
* 2. BaseFont baseFont = BaseFont.createFont("simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
* @param fontSize 字体大小
|
||||
* @param fontStyle 字体风格()
|
||||
* NORMAL = 0; BOLD = 1; ITALIC = 2; UNDERLINE = 4; STRIKETHRU = 8; BOLDITALIC = BOLD | ITALIC;
|
||||
* @param color 字体颜色
|
||||
*/
|
||||
public static void putParagraphAbsolutely(PdfReader reader, OutputStream outputStream, float x, float y, String content, BaseFont baseFont, float fontSize, int fontStyle, Color color) {
|
||||
addContent(reader, outputStream, content, x, y, baseFont, fontSize, fontStyle, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入文本的 raw 方法
|
||||
* @param reader PDF 读取流
|
||||
* @param outputStream 输出流
|
||||
* @param content 插入文本
|
||||
* @param x 左边距
|
||||
* @param y 下边距
|
||||
* @param baseFont 字体和编码设置
|
||||
* @param fontSize 字体大小
|
||||
* @param fontStyle 字体风格
|
||||
* @param color 字体颜色
|
||||
*/
|
||||
private static void addContent(PdfReader reader, OutputStream outputStream, String content, float x, float y, BaseFont baseFont, float fontSize, int fontStyle, Color color) {
|
||||
try {
|
||||
//生成 paragraph 并放在正确位置
|
||||
//抠模板
|
||||
PdfStamper stamper = new PdfStamper(reader, outputStream);
|
||||
PdfContentByte over = stamper.getOverContent(1);
|
||||
Font font = new Font(baseFont, fontSize, fontStyle, color);
|
||||
Paragraph insertContent = new Paragraph(content, font);
|
||||
|
||||
ColumnText columnText = new ColumnText(over);
|
||||
// llx 和 urx 最小的值决定离左边的距离. lly 和 ury 最大的值决定离下边的距离
|
||||
columnText.setSimpleColumn(x, y, Float.MAX_VALUE, Float.MIN_VALUE);
|
||||
columnText.addElement(insertContent);
|
||||
columnText.go();
|
||||
stamper.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.PdfReader;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
//生成资格面试通过函的工具
|
||||
public class PassLetterUtils {
|
||||
|
||||
/**
|
||||
* 生成通过函的方法
|
||||
* 返回通过函编码
|
||||
* @param partnerName 加盟商姓名
|
||||
* @param verifyCity 审批城市
|
||||
* @param passTime 审批通过时间
|
||||
*/
|
||||
public static String genPassLetter(String partnerName, String passCode, String verifyCity, DateTime passTime) {
|
||||
String randomNum = RandomUtil.randomNumbers(5);
|
||||
if (ObjectUtil.isEmpty(passCode)) {
|
||||
passCode = "HSAY" + DateUtil.format(passTime, "yyMMdd") + "-" + randomNum;
|
||||
}
|
||||
String passTimeStr = DateUtil.format(passTime, "yyyy年MM月dd日");
|
||||
Document document = new Document();
|
||||
try {
|
||||
//1. 创建 pdf document
|
||||
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
FileOutputStream outputStream = new FileOutputStream("passLetter.pdf");
|
||||
PdfWriter.getInstance(document, outputStream);
|
||||
document.open();
|
||||
|
||||
//2. 添加背景图片
|
||||
Image img = Image.getInstance(PassLetterUtils.class.getResource("/static/passLetterBg.jpg").toString());
|
||||
PDFUtils.setBackgroundImgA4(document, img);
|
||||
document.close();
|
||||
|
||||
//3. 填写通过函模板信息
|
||||
addContentToPdf(partnerName + " 先生/女士", 122, 640);
|
||||
addContentToPdf(passCode, 122, 558);
|
||||
addContentToPdf(verifyCity, 155, 494);
|
||||
addContentToPdf("60天", 135, 450);
|
||||
addContentToPdf(passTimeStr, 393, 152);
|
||||
return passCode;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addContentToPdf(String content, float x, float y) {
|
||||
try {
|
||||
PdfReader pdfReader = new PdfReader(Files.newInputStream(Paths.get("passLetter.pdf")));
|
||||
OutputStream outputStream = Files.newOutputStream(Paths.get("passLetter.pdf"));
|
||||
PDFUtils.putParagraphAbsolutely(pdfReader, outputStream, x, y, content, 20, new Color(255, 82,25));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import com.tencentyun.TLSSigAPIv2;
|
||||
|
||||
/**
|
||||
* 腾讯实时音视频TRTC工具类
|
||||
*/
|
||||
public class TRTCUtils {
|
||||
|
||||
/**
|
||||
* 默认过期时间 30 s
|
||||
*/
|
||||
private static final Long expired = 30L;
|
||||
|
||||
/**
|
||||
* 生成 userSig 用于进入会议
|
||||
* 详见 https://cloud.tencent.com/document/product/647/17275#.E8.B0.83.E8.AF.95.E8.B7.91.E9.80.9A.E9.98.B6.E6.AE.B5.E5.A6.82.E4.BD.95.E8.AE.A1.E7.AE.97-UserSig.EF.BC.9F
|
||||
*/
|
||||
public static String genUserSig(Long sdkAppId, String key, String userId) {
|
||||
TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, key);
|
||||
return tlsSigAPIv2.genUserSig(userId, expired);
|
||||
}
|
||||
|
||||
public static String genUserSig(Long sdkAppId, String key, String userId, Long expiredTime) {
|
||||
TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, key);
|
||||
return tlsSigAPIv2.genUserSig(userId, expiredTime);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user