Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

# Conflicts:
#	coolstore-partner-webc/src/main/java/com/cool/store/controller/PartnerController.java
This commit is contained in:
zhangchenbiao
2023-06-16 11:20:08 +08:00
68 changed files with 1245 additions and 211 deletions

View File

@@ -114,4 +114,8 @@ public class CommonConstants {
public static final String FOLLOW = "follow";
public static final String PENDING = "pending";
public static final String ALLOCATION = "allocation";
public static final String TRANSFER = "transfer";
}

View File

@@ -0,0 +1,17 @@
package com.cool.store.enums;
/**
* 动态栏目枚举类
*/
public enum ContentSubjectEnum {
HY_CULTURE("沪姨文化"),
PARTNER_SAYS("加盟商说"),
BRAND_NEWS("品牌动态")
;
private String subjectName;
ContentSubjectEnum(String subjectName) {
this.subjectName = subjectName;
}
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.enums;
/**
* 动态类型(图文/视频)
*/
public enum ContentTypeEnum {
VIDEO("视频"),
IMAGE("图文")
;
private String type;
ContentTypeEnum(String type) {
this.type = type;
}
}

View File

@@ -54,6 +54,8 @@ public enum ErrorCodeEnum {
WORK_FLOW_STAGE_PASS_ERROR(500002, "通过错误,非对应阶段!", null),
PARTNER_USER_NOT_EXIST(500003, "加盟商用户信息不存在!", null),
ZONE_NOT_EXIST(500004, "战区不存在!", null),
PARTNER_BASEINFO_NOT_EXIST(500005, "基本信息不存在!", null),
INTENT_INFO_NOT_EXIST(500006, "意向信息不存在!", null),
INTERVIEW_ENTER_FAIL(1021101, "进入面试间失败", null),

View File

@@ -94,10 +94,11 @@ public class PDFUtils {
* @param color 字体颜色
*/
private static void addContent(PdfReader reader, OutputStream outputStream, String content, float x, float y, BaseFont baseFont, float fontSize, int fontStyle, Color color) {
PdfStamper stamper = null;
try {
//生成 paragraph 并放在正确位置
//抠模板
PdfStamper stamper = new PdfStamper(reader, outputStream);
stamper = new PdfStamper(reader, outputStream);
PdfContentByte over = stamper.getOverContent(1);
Font font = new Font(baseFont, fontSize, fontStyle, color);
Paragraph insertContent = new Paragraph(content, font);
@@ -110,6 +111,14 @@ public class PDFUtils {
stamper.close();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (stamper != null) {
stamper.close();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}

View File

@@ -22,19 +22,16 @@ public class PassLetterUtils {
* 返回通过函编码
* @param partnerName 加盟商姓名
* @param verifyCity 审批城市
* @param passCode 通过函编码
* @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;
}
public static ByteArrayOutputStream genPassLetter(String partnerName, String passCode, String verifyCity, DateTime passTime) {
String passTimeStr = DateUtil.format(passTime, "yyyy年MM月dd日");
Document document = new Document();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
//1. 创建 pdf document
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
FileOutputStream outputStream = new FileOutputStream("passLetter.pdf");
// FileOutputStream outputStream = new FileOutputStream("passLetter.pdf");
PdfWriter.getInstance(document, outputStream);
document.open();
@@ -44,21 +41,38 @@ public class PassLetterUtils {
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;
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);
return outputStream;
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
document.close();
outputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private static void addContentToPdf(String content, float x, float y) {
/**
* 生成 passCode 的方法,拆分出来方便单独获取 passCode
* @return
*/
public static String genPassCode(DateTime passTime) {
String randomNum = RandomUtil.randomNumbers(5);
String passCode = "HSAY" + DateUtil.format(passTime, "yyMMdd") + "-" + randomNum;
return passCode;
}
private static void addContentToPdf(ByteArrayOutputStream outputStream, 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"));
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) {
throw new RuntimeException(e);