Ver Fonte

dep授权牌位置调整

zhijiezhao há 11 meses atrás
pai
commit
45eda601f2

+ 1 - 1
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -67,7 +67,7 @@ public class AuthApi {
     @ApiOperation("授权列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
-            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1授权列表,2授权审核列表,3供应商审核列表,4授权牌物流列表"),
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1授权列表,2授权审核列表,3供应商审核列表,4授权牌物流列表,5下载授权牌"),
             @ApiImplicitParam(name = "authParty", required = false, value = "授权机构"),
             @ApiImplicitParam(name = "mobile", required = false, value = "机构用户手机号"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),

+ 65 - 15
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -469,12 +469,51 @@ public class AuthServiceImpl implements AuthService {
         return null;
     }
 
+    /**
+     * 授权牌二维码及logo图片拼接
+     * @param template
+     * @param auth
+     * @return
+     */
     private Map<String, Object> getTemplateInfo(TemplateVo template, CmBrandAuthPo auth) {
         HashMap<String, Object> map = new HashMap<>();
         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) {
+            // ross
             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())) {
                 // 获取授权牌logo位置
                 try {
@@ -493,6 +532,28 @@ public class AuthServiceImpl implements AuthService {
                     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())) {
                 map.put("addWord1_content", auth.getAuthCode());
@@ -501,7 +562,7 @@ public class AuthServiceImpl implements AuthService {
                 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));
+                map.put("addWord1_y", (int) Math.round(4925 * rate));
             }
             // 添加认证日期信息
             if (null != auth.getAuthDate()) {
@@ -511,19 +572,8 @@ public class AuthServiceImpl implements AuthService {
                 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(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;

+ 3 - 0
src/main/resources/mapper/AuthMapper.xml

@@ -200,6 +200,9 @@
         <if test="4 == listType">
             and a.auditStatus = 1
         </if>
+        <if test="5 == listType">
+            and a.authImageType in (1,2)
+        </if>
         <if test="shopAuditStatus != null">
             <if test="0 == shopAuditStatus">
                 and (a.shopAuditStatus = 2 or (a.shopAuditStatus = 1 and ifnull(bp.waitAuditNum,0) > 0))