|
@@ -469,12 +469,51 @@ public class AuthServiceImpl implements AuthService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 授权牌二维码及logo图片拼接
|
|
|
|
+ * @param template
|
|
|
|
+ * @param auth
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
private Map<String, Object> getTemplateInfo(TemplateVo template, CmBrandAuthPo auth) {
|
|
private Map<String, Object> getTemplateInfo(TemplateVo template, CmBrandAuthPo auth) {
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
Integer templateId = template.getTemplateId();
|
|
Integer templateId = template.getTemplateId();
|
|
|
|
+ double rate = 0.15;
|
|
|
|
+ // 添加二维码信息
|
|
|
|
+ if (StringUtils.isNotEmpty(template.getQrPosition())) {
|
|
|
|
+ String qrCodeLink = zpServer + "/" + auth.getAuthUserId() + "/" + authMapper.getPrefix(auth.getAuthUserId()) + "/approve/club/detail?id=" + auth.getId();
|
|
|
|
+ map.put("addQr1_link", qrCodeLink);
|
|
|
|
+ map.put("addQr1_size", template.getQrSize());
|
|
|
|
+ String[] split = template.getQrPosition().split(",");
|
|
|
|
+ if (split.length == 2) {
|
|
|
|
+ map.put("addQr1_x", Integer.parseInt(split[0]));
|
|
|
|
+ map.put("addQr1_y", Integer.parseInt(split[1]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (1 == templateId) {
|
|
if (1 == templateId) {
|
|
|
|
+ // ross
|
|
map.put("templateImage", template.getTemplateImage());
|
|
map.put("templateImage", template.getTemplateImage());
|
|
- double rate = 0.15;
|
|
|
|
|
|
+ // 添加认证编号信息
|
|
|
|
+ if (StringUtils.isNotEmpty(auth.getAuthCode())) {
|
|
|
|
+ map.put("addWord1_content", auth.getAuthCode());
|
|
|
|
+ map.put("addWord1_color", "218,185,107");
|
|
|
|
+ map.put("addWord1_type", "思源宋体");
|
|
|
|
+ map.put("addWord1_style", Font.BOLD);
|
|
|
|
+ map.put("addWord1_size", (int) Math.round(90 * rate));
|
|
|
|
+ map.put("addWord1_x", (int) Math.round(2168 * rate));
|
|
|
|
+ map.put("addWord1_y", (int) Math.round(3157 * rate));
|
|
|
|
+ }
|
|
|
|
+ // 添加认证日期信息
|
|
|
|
+ if (null != auth.getAuthDate()) {
|
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
|
|
|
|
+ map.put("addWord2_content", format.format(auth.getAuthDate()));
|
|
|
|
+ map.put("addWord2_color", "218,185,107");
|
|
|
|
+ map.put("addWord2_type", "思源宋体");
|
|
|
|
+ map.put("addWord2_style", Font.PLAIN);
|
|
|
|
+ map.put("addWord2_size", (int) Math.round(90 * rate));
|
|
|
|
+ map.put("addWord2_x", (int) Math.round(2085 * rate));
|
|
|
|
+ map.put("addWord2_y", (int) Math.round(3289 * rate));
|
|
|
|
+ }
|
|
if (StringUtils.isNotEmpty(auth.getAuthImageLogo())) {
|
|
if (StringUtils.isNotEmpty(auth.getAuthImageLogo())) {
|
|
// 获取授权牌logo位置
|
|
// 获取授权牌logo位置
|
|
try {
|
|
try {
|
|
@@ -493,6 +532,28 @@ public class AuthServiceImpl implements AuthService {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ if (2 == templateId) {
|
|
|
|
+ // dep
|
|
|
|
+ map.put("templateImage", template.getTemplateImage());
|
|
|
|
+ if (StringUtils.isNotEmpty(auth.getAuthImageLogo())) {
|
|
|
|
+ // 获取授权牌logo位置
|
|
|
|
+ try {
|
|
|
|
+ ImageIcon imageIcon = new ImageIcon(new URL(template.getTemplateImage()));
|
|
|
|
+ Image srcImg = imageIcon.getImage();
|
|
|
|
+ int srcWidth = srcImg.getWidth(null);
|
|
|
|
+ ImageIcon authImageLogo = new ImageIcon(new URL(auth.getAuthImageLogo()));
|
|
|
|
+ Image authLogo = authImageLogo.getImage();
|
|
|
|
+ int authLogoWidth = authLogo.getWidth(null);
|
|
|
|
+ int x = (srcWidth - (int) Math.round(335 * rate) - authLogoWidth) / 2 + (int) Math.round(238 * rate);
|
|
|
|
+ int y = (int) Math.round(1560 * rate);
|
|
|
|
+ map.put("addImage1_x", x);
|
|
|
|
+ map.put("addImage1_y", y);
|
|
|
|
+ map.put("addImage1_image", auth.getAuthImageLogo());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 添加认证编号信息
|
|
// 添加认证编号信息
|
|
if (StringUtils.isNotEmpty(auth.getAuthCode())) {
|
|
if (StringUtils.isNotEmpty(auth.getAuthCode())) {
|
|
map.put("addWord1_content", auth.getAuthCode());
|
|
map.put("addWord1_content", auth.getAuthCode());
|
|
@@ -501,7 +562,7 @@ public class AuthServiceImpl implements AuthService {
|
|
map.put("addWord1_style", Font.BOLD);
|
|
map.put("addWord1_style", Font.BOLD);
|
|
map.put("addWord1_size", (int) Math.round(90 * rate));
|
|
map.put("addWord1_size", (int) Math.round(90 * rate));
|
|
map.put("addWord1_x", (int) Math.round(2168 * rate));
|
|
map.put("addWord1_x", (int) Math.round(2168 * rate));
|
|
- map.put("addWord1_y", (int) Math.round(3157 * rate));
|
|
|
|
|
|
+ map.put("addWord1_y", (int) Math.round(4925 * rate));
|
|
}
|
|
}
|
|
// 添加认证日期信息
|
|
// 添加认证日期信息
|
|
if (null != auth.getAuthDate()) {
|
|
if (null != auth.getAuthDate()) {
|
|
@@ -511,19 +572,8 @@ public class AuthServiceImpl implements AuthService {
|
|
map.put("addWord2_type", "思源宋体");
|
|
map.put("addWord2_type", "思源宋体");
|
|
map.put("addWord2_style", Font.PLAIN);
|
|
map.put("addWord2_style", Font.PLAIN);
|
|
map.put("addWord2_size", (int) Math.round(90 * rate));
|
|
map.put("addWord2_size", (int) Math.round(90 * rate));
|
|
- map.put("addWord2_x", (int) Math.round(2085 * rate));
|
|
|
|
- map.put("addWord2_y", (int) Math.round(3289 * rate));
|
|
|
|
- }
|
|
|
|
- // 添加二维码信息
|
|
|
|
- if (StringUtils.isNotEmpty(template.getQrPosition())) {
|
|
|
|
- String qrCodeLink = zpServer + "/" + auth.getAuthUserId() + "/" + authMapper.getPrefix(auth.getAuthUserId()) + "/approve/club/detail?id=" + auth.getId();
|
|
|
|
- map.put("addQr1_link", qrCodeLink);
|
|
|
|
- map.put("addQr1_size", template.getQrSize());
|
|
|
|
- String[] split = template.getQrPosition().split(",");
|
|
|
|
- if (split.length == 2) {
|
|
|
|
- map.put("addQr1_x", Integer.parseInt(split[0]));
|
|
|
|
- map.put("addQr1_y", Integer.parseInt(split[1]));
|
|
|
|
- }
|
|
|
|
|
|
+ map.put("addWord2_x", (int) Math.round(2020 * rate));
|
|
|
|
+ map.put("addWord2_y", (int) Math.round(5065 * rate));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
return map;
|